新人问,关于stmp发送邮件问题(50分)

  • 主题发起人 ngmantis
  • 开始时间
N

ngmantis

Unregistered / Unconfirmed
GUEST, unregistred user!
begin
begin
WITH IDMessage1 do
begin
clear;
idmessage1.Subject:= edit2.Text;
idmessage1.from.Address:= 'fking666@163.com';
idmessage1.ReceiptRecipient.Address:= 'fking6666@163.com';
idmessage1.body.Assign(memo1.Lines);
idsmtp1.Host:= 'smtp.163.com' ;
IdSMTP1.Port:= 25;
idsmtp1.Authen
ticationType:= atNone;
idsmtp1.Username:='fking666' ;
idsmtp1.Password:='*********' ;
try
idsmtp1.Connect();
idsmtp1.Send(idmessage1);
idsmtp1.Disconnect;
application.MessageBox('邮件发送成功!','提示',MB_OK+MB_ICONINFORMATION);
EXCEPT
application.MessageBox('邮件发送失败!','提示',MB_OK+MB_ICONINFORMATION);
end;
end;
end;



出现 用户被锁定......希望好心人能给个通过了的代码
 
首先,你用的是网易的邮件服务器,网易对新用户(好像是2008年后的,你上网查查)不开放SMTP服务,也就是说你可以登陆它的网站收发邮件但不可以在自己开发的客户端程序中使用它的服务器,如'smtp.163.com';
其次,现在大部分邮件服务器都需要进行验证的,所以如果你是用的Indy10.0的控件的话,那么这句idsmtp1.Authen
ticationType:= atNone;可以不要,你这句是设定不需验证的。
 
谢谢意思是不是,,我程序其实是没错的,,只是smtp.163.com不可用造成的吗?
那如果我验证后,,能不能使用呢
 
你的程序代码没有什么大问题(除了这句:idsmtp1.Authen
ticationType:= atNone;
要改成atDefault或atLogin),你换一个邮件服务器(比如搜狐的),通过验证后就可以发送了了。(不过搜狐的邮件服务器对客户端程序的支持不是很好,好像有发件次数的限制)
 
begin
begin
WITH IDMessage1 do
begin
clear;
idmessage1.Subject:= edit2.Text;
idmessage1.from.Address:= 'fking666@sohu.com';
idmessage1.ReceiptRecipient.Address:= 'fking888@sohu.com';
idmessage1.body.Assign(memo1.Lines);
idsmtp1.Host:= 'smtp.sohu.com' ;
IdSMTP1.Port:= 25;
idsmtp1.Authen
ticationType:= atlogin;
idsmtp1.Username:='fking666' ;
idsmtp1.Password:='*********' ;
try
idsmtp1.Connect();
idsmtp1.Send(idmessage1);
idsmtp1.Disconnect;
application.MessageBox('邮件发送成功!','提示',MB_OK+MB_ICONINFORMATION);
EXCEPT
application.MessageBox('邮件发送失败!','提示',MB_OK+MB_ICONINFORMATION);
end;
end;
end;

改成sohu的也不行,,,,,出现

project project1.exe raised exception class EIDrotocolReplyError with message'5.5.1Error:no valid recipients '. Process stopped.Use Step or Run to continue.
 
你的用户名是'fking666'吗?应该是'fking666◎sohu.com',也就是你的搜狐邮箱地址。
 
谢谢,我知道是怎么回事了
 
顶部