Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>For sending e-mails using Lotus Notes (even if it looks for me like an overkill a bit) I found <a href="http://www.fabalou.com/VBandVBA/lotusnotesmail.asp" rel="nofollow"><code>this post</code></a> and tried to translate it to Delphi code but I can't test it anywhere, so I can't tell you if this works or not. I have left the original comments in there.</p> <pre><code>uses ComObj, StrUtils; // Public Sub SendNotesMail(Subject as string, attachment as string, // recipient as string, bodytext as string,saveit as Boolean) // This public sub will send a mail and attachment if neccessary to the // recipient including the body text. // Requires that notes client is installed on the system. procedure SendNotesMail(const Subject: string; const Attachment: string; const Recipient: string; const BodyText: string; const SaveIt: Boolean); var Maildb: OleVariant; // The mail database UserName: string; // The current users notes name MailDbName: string; // The current users notes mail database name MailDoc: OleVariant; // The mail document itself AttachME: OleVariant; // The attachment richtextfile object Session: OleVariant; // The notes session EmbedObj: OleVariant; // The embedded object (Attachment) begin Session := CreateOleObject('Notes.NotesSession'); // Next line only works with 5.x and above. Replace password with your password Session.Initialize('password'); // Get the sessions username and then calculate the mail file name // You may or may not need this as for MailDBname with some systems you // can pass an empty string or using above password you can use other mailboxes. UserName := Session.UserName; MailDbName := LeftStr(UserName, 1) + RightStr(UserName, (Length(UserName) - Pos(UserName, ' '))) + '.nsf'; // Open the mail database in notes Maildb := Session.GETDATABASE('', MailDbName); if not Maildb.ISOPEN then Maildb.OPENMAIL; // Set up the new mail document MailDoc := Maildb.CREATEDOCUMENT; MailDoc.Form := 'Memo'; MailDoc.sendto := Recipient; MailDoc.Subject := Subject; MailDoc.Body := BodyText; MailDoc.SAVEMESSAGEONSEND := SaveIt; // Set up the embedded object and attachment and attach it if Attachment &lt;&gt; '' Then begin AttachME := MailDoc.CREATERICHTEXTITEM('Attachment'); EmbedObj := AttachME.EMBEDOBJECT(1454, '', Attachment, 'Attachment'); MailDoc.CREATERICHTEXTITEM('Attachment'); end; // Send the document MailDoc.PostedDate := Now; // Gets the mail to appear in the sent items folder MailDoc.SEND(0, Recipient); end; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload