德尔福的电子邮件程序
发布时间:2020-12-15 09:29:23 所属栏目:大数据 来源:网络整理
导读:我正在delphi 7中构建一个电子邮件发送应用程序.我机器上的默认电子邮件客户端配置了Lotus Notes. 我在应用程序中单击“发送”按钮时尝试了 shellExecute命令.但是在这个 ShellExecute中弹出莲花笔记给用户注意主题,身体等,然后用户需要点击莲花笔记中的发送
我正在delphi 7中构建一个电子邮件发送应用程序.我机器上的默认电子邮件客户端配置了Lotus Notes.
我在应用程序中单击“发送”按钮时尝试了 shellExecute命令.但是在这个 ShellExecute中弹出莲花笔记给用户注意主题,身体等,然后用户需要点击莲花笔记中的发送按钮. 我想当用户点击我的应用程序的发送按钮然后自动发送电子邮件应该使用莲花笔记发送.我们可以使用ShellExecute吗?我也试过使用Indy组件,但我没有得到SMTP详细信息.如何找到SMTP服务器详细信息? 解决方法
为了使用Lotus Notes发送电子邮件(即使它看起来像一个过度杀戮)我发现
this post 并尝试将其转换为Delphi代码,但我无法在任何地方测试它,所以我不能告诉你这是不是是否有效.我已将原始评论留在那里.
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 <> '' 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; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |