IdSMTP.Host := 'smtp.163.com';
IdSMTP.Port := 25;
IdSMTP.UserName := 'lymanage_xxx';
IdSMTP.Password := 'xxxx';
IdSMTP.AuthenticationType := atLogin; //设置SMTP
IdMessage.From.Address := '[email protected]';
IdMessage.Recipients.EMailAddresses := '[email protected]'; IdMessage.Subject := pSubject;
IdMessage.Body.Text := pBody; try
try
IdSMTP.Connect;
IdSMTP.Send(IdMessage);
result := '邮件发送成功.';
except
on E: Exception do
result := '出错:' + E.message;
end;
finally
if IdSMTP.Connected then
IdSMTP.Disconnect;
end;
IdSMTP.Port := 25;
IdSMTP.UserName := 'lymanage_xxx';
IdSMTP.Password := 'xxxx';
IdSMTP.AuthenticationType := atLogin; //设置SMTP
IdMessage.From.Address := '[email protected]';
IdMessage.Recipients.EMailAddresses := '[email protected]'; IdMessage.Subject := pSubject;
IdMessage.Body.Text := pBody; try
try
IdSMTP.Connect;
IdSMTP.Send(IdMessage);
result := '邮件发送成功.';
except
on E: Exception do
result := '出错:' + E.message;
end;
finally
if IdSMTP.Connected then
IdSMTP.Disconnect;
end;
procedure TIdSMTP.Send(AMsg: TIdMessage);
...
//SendCmd('Rset'); {Do not localize}多发送了一个"Rest" command 然后163的smtp服务器就会断开,只要把idsmtp.pas中的这一句(大概是241行吧),注释掉就OK了老大,开技术贴,给分~~~~~
procedure TIdSMTP.Send(AMsg: TIdMessage);
...
//SendCmd('Rset'); {Do not localize}多发送了一个"Rest" command 然后163的smtp服务器就会断开,只要把idsmtp.pas中的这一句(大概是241行吧),注释掉就OK了对了,要把idsmtp.pas这个添加到你的Project中编译才行---------------------------------------------
已经做了,还是没有有问题