/////////////////////////////////////////////////////////////// // Object : OLE_Lotus_Notes // Author : PowerObject! [Shekar Reddy] // Date : 10/24/2003 /////////////////////////////////////////////////////////////// // Arg : s_Memo // Return : (None) /////////////////////////////////////////////////////////////// // Desc : OLE Automation of Lotus Notes // Usage : You may use the following s_Memo structure for data /////////////////////////////////////////////////////////////// // Modifications: // Date Version Author Comments /////////////////////////////////////////////////////////////// integer li_Code, li_Count, li_Upper boolean lb_Flag string ls_Server, ls_FilePath OLEObject Notes, NotesDB, NotesMail, NotesBody // /* You may use this structure in sending data to this function ----------------------------------------------------------- $PBExportHeader$s_memo.srs $PBExportComments$Allows creation of Lotus Notes mail global type s_memo from structure string s_send_to string s_copy_to string s_blind_copy string s_subject string s_body_text unsignedlong s_body_comp unsignedlong s_priority unsignedlong s_delivery_report boolean s_return_receipt string s_attachments[] end type */ // Connect to Lotus Notes Notes = CREATE OLEObject li_Code = Notes.ConnectToNewObject( "Notes.NotesSession" ) // IF li_Code < 0 THEN // Could not Connect to Notes MessageBox( "Connect to Notes Failed", String( li_Code )) RETURN -1 END IF // // Open the mail database NotesDB = Notes.GetDatabase( "", "" ) NotesDB.OpenMail() // lb_Flag = TRUE // Init! // IF NOT NotesDB.IsOpen() THEN lb_Flag = NotesDB.Open( "", "" ) END IF // ls_Server = NotesDB.Server() ls_FilePath = NotesDB.FilePath() // IF NOT lb_Flag THEN MessageBox( "Cannot open mail file", "Server: " + & ls_Server + " " + ls_FilePath ) END IF // // Create Notes Mail NotesMail = NotesDB.CreateDocument() NotesMail.Form = "Memo" // // You can use the s_Memo structure for data // // The first element and the Cc is read from the Notes Address-book NotesMail.SendTo = { "Shekar Reddy", "PowerObject-subscribe@YahooGroups.com" } NotesMail.CopyTo = "PowerObject" //NotesMail.BlindCopyTo = "" NotesMail.Subject = "OLE Automation of Lotus Notes" // // Store the sent e-mail in the "Sent" folder NotesMail.SaveMessageOnSend = TRUE // // Don't return receipt NotesMail.Receipt = FALSE // // Create Notes Body NotesBody = NotesMail.CreateRichTextItem( "BODY" ) NotesMail.Body = "Test-mail automating Lotus Notes using OLE." // // Embed the attachments inside the message body li_Bound = UpperBound( lstr_Mail.s_Attachments ) // // Add the attachments to Notes Body FOR li_Elem = 1 TO li_Bound NotesBody.EmbedObject( 1454, "", & lstr_Mail.s_Attachments[ li_Elem ] ) NEXT // // NotesMail.Visible = TRUE // // Send Notes Mail (may prompt for the Notes Password if not up) NotesMail.Send( FALSE ) // // Disconnect Notes Notes.DisconnectObject() // MessageBox( "Lotus Notes", "Message sent successfully!" ) // // Unwind... IF IsValid( Notes ) THEN DESTROY Notes END IF // IF IsValid( NotesDB ) THEN DESTROY NotesDB END IF // IF IsValid( NotesMail ) THEN DESTROY NotesMail END IF // IF IsValid( NotesBody ) THEN DESTROY NotesBody END IF // RETURN 1 /////////////////////////////////////////////////////////////// --- PowerObject!