const olMailItem = 0;
var Outlook: OLEVariant;
MailItem: Variant;
begin
try
Outlook := GetActiveOleObject('Outlook.Application');
except
Outlook := CreateOleObject('Outlook.Application');
end;
MailItem := Outlook.CreateItem(olMailItem);
MailItem.Recipients.Add('Kingron@163.net');
MailItem.Subject := 'your subject';
MailItem.Body := 'http://kingron.myetang.com';
MailItem.Attachments.Add('C:\Windows\system.dat');
MailItem.Send;
Oulook := Unassigned;
end;
*************************
发送HTML格式邮件
下面的代码没有测试,因为我没有Outlook,而我又找不到Outlook express的CLSID或者ProgID…… :-(
var
Oe,MI:OleVariant;
begin
Oe:=CreateOleObject('Outlook.Application');
MI:=Oe.CreateItem(0);
MI.Subject:='subject';
MI.HTMLBody:='<html>..Input your HTML Source Here....</html>';
MI.Recipients.Add('Mail address like :1@2.3');
MI.Send;
MI:=Unassigned;
OE:=Unassigned;
end;