调用outlook发邮件 ( 积分: 50 )

  • 主题发起人 主题发起人 job2125
  • 开始时间 开始时间
J

job2125

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TTelfrmDetail.SendOutlookMail(SEmail:string);
const
olMailItem = 0;
var
Outlook: OleVariant;
vMailItem: variant;
fpath:string;
mfile:TiniFile;
begin
try
Outlook := GetActiveOleObject('Outlook.Application');
except
try
Outlook := CreateOleObject('Outlook.Application');
except
MessageBox(handle,'你的系统没有安装OutLook程序!','系统提示',64);
Exit;
end;
end;
fpath := ExtractFilePath(Paramstr(0))+'sendEmail.ini';
mFile:=TiniFile.Create(fpath);

vMailItem := Outlook.CreateItem(olMailItem);
vMailItem.Recipients.Add(SEmail);
vMailItem.Subject := mFile.ReadString('sendEmail','Subject','');
vMailItem.Body := mFile.ReadString('sendEmail','Body','');
vMailItem.Attachments.Add(mFile.ReadString('sendEmail','Attachments',''));
// vMailItem.Send;

VarClear(Outlook);
mFile.Free;
end;

系统提示找不到outlook,但我系统中明明装了outlook,请高手致电迷津。
 
procedure TTelfrmDetail.SendOutlookMail(SEmail:string);
const
olMailItem = 0;
var
Outlook: OleVariant;
vMailItem: variant;
fpath:string;
mfile:TiniFile;
begin
try
Outlook := GetActiveOleObject('Outlook.Application');
except
try
Outlook := CreateOleObject('Outlook.Application');
except
MessageBox(handle,'你的系统没有安装OutLook程序!','系统提示',64);
Exit;
end;
end;
fpath := ExtractFilePath(Paramstr(0))+'sendEmail.ini';
mFile:=TiniFile.Create(fpath);

vMailItem := Outlook.CreateItem(olMailItem);
vMailItem.Recipients.Add(SEmail);
vMailItem.Subject := mFile.ReadString('sendEmail','Subject','');
vMailItem.Body := mFile.ReadString('sendEmail','Body','');
vMailItem.Attachments.Add(mFile.ReadString('sendEmail','Attachments',''));
// vMailItem.Send;

VarClear(Outlook);
mFile.Free;
end;

系统提示找不到outlook,但我系统中明明装了outlook,请高手致电迷津。
 
帮顶

--------签名档---------------------------

惊爆开源站

http://www.source520.com

80G源码电子书免费免注册下载,大量精辟技术文档库随时更新
 
后退
顶部