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;