Einzelnen Beitrag anzeigen

madtom

Registriert seit: 24. Feb 2005
Ort: Hamburg
115 Beiträge
 
Delphi XE7 Professional
 
#4

AW: EMail über Outlook 2003 versenden

  Alt 16. Aug 2013, 18:51
Gerade getestet:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  aMailItem: _MailItem;
  aNameSpace: NameSpace;
  aFolder: MAPIFolder;
  Recipient: string;
begin
  aMailItem := OutlookApplication1.CreateItem(olMailItem) as _MailItem;
  aNameSpace := OutlookApplication1.GetNamespace('MAPI');
  aNameSpace.Logon(EmptyParam, EmptyParam, False, True);
  aFolder := aNameSpace.GetDefaultFolder(olFolderOutbox);
  Recipient := 'email@address.de';
  aMailItem.Importance := olImportanceHigh;
  aMailItem.Recipients.Add(Recipient);
  aMailItem.Attachments.Add('C:\XXX\Bild.bmp', EmptyParam, EmptyParam, EmptyParam);
  aMailItem.Subject := 'Attachment Test';
  aMailItem.Body := 'This is an Email with an Attachment';
  aMailItem.Send;
end;
Thomas
Delphi Programming
  Mit Zitat antworten Zitat