德尔福的电子邮件程序

Nal*_*alu 5 delphi

我正在delphi 7中构建一个电子邮件发送应用程序.我机器上的默认电子邮件客户端配置了Lotus Notes.我在应用程序中单击"发送"按钮时尝试了shellExecute命令.但是在这个ShellExecute中弹出莲花笔记给用户注意主题,身体等,然后用户需要点击莲花笔记中的发送按钮.

我想当用户点击我的应用程序的发送按钮然后自动发送电子邮件应该使用莲花笔记发送.我们可以使用ShellExecute吗?我也试过使用Indy组件,但我没有得到SMTP详细信息.如何找到SMTP服务器详细信息?感谢帮助

TLa*_*ama 3

对于使用 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;
Run Code Online (Sandbox Code Playgroud)