select * 后,自己写文件啊。
然后使用 NMSMTP控间发送。我得一个项目重的一个函数或许你可以看看:
function SendMail(s:WideString;UserName:string;which:string):Boolean;
var
email:string;
begin
{ DONE : 发给用户的email }
try try
if (MailSmtpServerConnect()) then
begin
email:=GetUserEmail(UserName);
Form_main.NMSMTP1.PostMessage.FromAddress :='[email protected]';
Form_main.NMSMTP1.PostMessage.FromName :='定单管理员';
Form_main.NMSMTP1.PostMessage.ToAddress.Text :=email;
Form_main.NMSMTP1.PostMessage.ToCarbonCopy.Text :='';
Form_main.NMSMTP1.PostMessage.ToBlindCarbonCopy.Text :='';
Form_main.NMSMTP1.PostMessage.Body.Text :=s;
Form_main.NMSMTP1.PostMessage.Attachments.Text := '';
if (which='cuikuan') then
Form_main.NMSMTP1.PostMessage.Subject :='新华在线提醒您!'
else
Form_main.NMSMTP1.PostMessage.Subject :='新华在线订货单';
Form_main.NMSMTP1.PostMessage.LocalProgram := '';
Form_main.NMSMTP1.PostMessage.Date :=DateTimeToStr(Now);
Form_main.NMSMTP1.PostMessage.ReplyTo :='[email protected]';
Form_main.NMSMTP1.SendMail;
result:=true;
Form_main.NMSMTP1.Disconnect;
end;
except
result:=false;
end;
finally
end;end;
然后使用 NMSMTP控间发送。我得一个项目重的一个函数或许你可以看看:
function SendMail(s:WideString;UserName:string;which:string):Boolean;
var
email:string;
begin
{ DONE : 发给用户的email }
try try
if (MailSmtpServerConnect()) then
begin
email:=GetUserEmail(UserName);
Form_main.NMSMTP1.PostMessage.FromAddress :='[email protected]';
Form_main.NMSMTP1.PostMessage.FromName :='定单管理员';
Form_main.NMSMTP1.PostMessage.ToAddress.Text :=email;
Form_main.NMSMTP1.PostMessage.ToCarbonCopy.Text :='';
Form_main.NMSMTP1.PostMessage.ToBlindCarbonCopy.Text :='';
Form_main.NMSMTP1.PostMessage.Body.Text :=s;
Form_main.NMSMTP1.PostMessage.Attachments.Text := '';
if (which='cuikuan') then
Form_main.NMSMTP1.PostMessage.Subject :='新华在线提醒您!'
else
Form_main.NMSMTP1.PostMessage.Subject :='新华在线订货单';
Form_main.NMSMTP1.PostMessage.LocalProgram := '';
Form_main.NMSMTP1.PostMessage.Date :=DateTimeToStr(Now);
Form_main.NMSMTP1.PostMessage.ReplyTo :='[email protected]';
Form_main.NMSMTP1.SendMail;
result:=true;
Form_main.NMSMTP1.Disconnect;
end;
except
result:=false;
end;
finally
end;end;
解决方案 »
- 求解双网卡和GPRS路由设置的问题,急等!
- 请问如何制作程序自动更新?
- 各位大哥谁能推荐一个好的报表控件(免费)给我
- 怎么把一个LongInt转化成TForm1呢??
- 请问怎么把real型变成str型,谢谢
- sql里把时间再加几个月,应该如何处理
- 奇怪,下了个BDE5.2 UPDATE 竟然不能安装
- 为什么我做的chm帮助会出现乱码?
- 打听一下, Delphi7能开发GoogleEarth的软件吗?
- delphi7 edit文本框鼠标左键不能点入 右键可以点入 这是为什么呀?
- Informix中把Money类型的字段转成VarChar类型的函数是什么呀?
- Delphi 的.dpk工程编译不成功
{-----------------------------
desc: connect to smtp server
------------------------------}
function MailSmtpServerConnect():Boolean;
begin
try
begin
Form_main.NMSMTP1.Host :=SmtpServer;
Form_main.NMSMTP1.Port :=Port;
Form_main.NMSMTP1.UserID :=UserID;
Form_main.NMSMTP1.Connect;
result:=true;
end;
except
result:=false;
end;
end;