...eine E-Mail über Outlook verschicken?
|
Autor:
Thomas Stutz |
[ Tip ausdrucken ] | | |
uses
ComObj;
procedure TForm1.Button16Click(Sender: TObject);
const
olMailItem = 0;
olByValue = 1;
var
OutlookApp, MailItem, MyAttachments: OLEVariant;
begin
try
OutlookApp := GetActiveOleObject('Outlook.Application');
except
OutlookApp := CreateOleObject('Outlook.Application');
end;
try
MailItem := OutlookApp.CreateItem(olMailItem);
MailItem.Recipients.Add('YourMailAddress@something.com');
MailItem.Subject := 'Your Subject';
MailItem.Body := 'Your Message';
myAttachments := MailItem.Attachments;
myAttachments.Add('C:\SomeFile.txt', olByValue, 1, 'Name of Attachment');
MailItem.Send;
finally
myAttachments := VarNull;
OutlookApp := VarNull;
end;
end;
Bewerten Sie diesen Tipp:
|
|
|