google查的都是用Delphi6 写的,
下载的程序在delphi7都跑不了郁闷~~~
下载的程序在delphi7都跑不了郁闷~~~
解决方案 »
- 好久没来了,散点分分。。
- 求BT的delphi或者c++实现源码(顶有分)
- 不能在动态库中使用消息机制?!!!如何解决?紧急
- 如何用D6做帮助文件?(菜鸟级问题)
- 有关MainMenu的问题!急!
- 能在程序中操纵数据库吗
- 挑战权威—————————— 由C#风潮想起的-给初学编程者的忠告 作者--刘巍:高级程序员、软件设计师
- Delphi 打印的超困惑问题!
- TwebBrowser 如何调用IE的"Internet 选项"
- 在Delphi中的TString与VB的什么数据类型或结构对应?
- 请问如何另存网页中已经显示的一张图片(不要重新从网上下载)
- 真奇怪,为什么我的POS取字符位置,总是返回0
DEMO等待发送中......
等待E-MAIL
IdTCPConnection, IdTCPClient, IdMessageClient, IdSMTP;type
Tmailsetting = record
smtpserver: string;//eg:stmp.sohu.com
sendfrom: string;//[email protected]
sendto: string;//[email protected]
subject: string;//题目
emailtext: string;//正文
sendsetting: string;//可以不用
authentication: boolean;//是否验证:true
userid: string;//你的邮箱帐号
password: string;//邮箱密码
end;
{可以用sohu的smtp.sohu.com代理发送}
{gmail的认证不一样就不行了}
{要想在163上发送,要在空间源码上修改}
{具体去查大富翁论坛}function sendmail(mailsetting:Tmailsetting):string;
var
smtp:Tidsmtp;
mailmessage:Tidmessage;
begin
//设置SMTP
try
smtp:=Tidsmtp.Create(nil);
mailmessage:=Tidmessage.Create(nil);
SMTP.Host := mailsetting.smtpserver; //具体使用的SMTP,可以到你申请的邮箱所在的网站中去找
if mailsetting.smtpserver='' then
begin
result:='SMTP server is null';
exit
end;
SMTP.Port := 25;
if mailsetting.authentication then
begin
smtp.AuthenticationType:=atlogin;
if (mailsetting.userid='') or (mailsetting.password='') then
begin
result:='Authentication option is null';
exit;
end;
smtp.Username:=global_unit.DecodeBase64(mailsetting.userid);
smtp.Password:=global_unit.DecodeBase64(mailsetting.password);//
end
else
smtp.AuthenticationType:=atnone; //设置邮件内容
MailMessage.From.Address :=mailsetting.sendfrom;
if mailsetting.sendfrom='' then
begin
result:='send from addr is null';
exit;
end;
mailmessage.Recipients.EMailAddresses:=mailsetting.sendto;
if mailsetting.sendto='' then
begin
result:='sendto addr is null';
exit;
end;
MailMessage.Subject :=mailsetting.subject;
MailMessage.Body.Text :=mailsetting.emailtext;
except
result:='other unkown error';
exit;
end;
//发送邮件
try
try
SMTP.Connect(1000);
SMTP.Send(MailMessage);
result:='Send mail sucess';
except on E: Exception do
result:=e.Message;
end;
finally
if SMTP.Connected then
SMTP.Disconnect;
smtp.Free;
mailmessage.Free;
end;
end;{看看能不能帮你}