在delphi如何调用outlook(100分)

  • 主题发起人 chenhaipeng
  • 开始时间
C

chenhaipeng

Unregistered / Unconfirmed
GUEST, unregistred user!
在delphi如何调用outlook发e_mail
 
shellexecute, 文件名是 "mailto:mikedeakins@chinaren.com"
 
在单元中添加ShellApi,
使用 shellexecute(nil,nil,'mailto:hzj_mail@21cn.com',nil);
即可
 
shellexecute(handle,nil,'mailto:support@handoo.com.cn',nil,nil,SW_SHOWnormal);
 
Uses ShellApi;
...........
shellexecute(handle,nil,'mailto:jollier@371.net',nil,nil,SW_SHOWNORMAL);
这还得看你的系统中的默认发邮件软件是不是OUTLOOK.
 
procedure SendOutlookMail;
const
olMailItem = 0;
var
Outlook: OleVariant;
vMailItem: variant;
begin
try
Outlook := GetActiveOleObject('Outlook.Application');
except
Outlook := CreateOleObject('Outlook.Application');
end;
vMailItem := Outlook.CreateItem(olMailItem);
vMailItem.Recipients.Add('dummy@hotmail.com');
vMailItem.Subject := 'test email';
vMailItem.Body := 'This is a test';
vMailItem.Attachments.Add('C:/temp/sample.txt');
vMailItem.Send;

VarClear(Outlook);
end;

 
多人接受答案了。
 
顶部