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;

解决方案 »

  1.   

    这个原因是因为IdSMTP的成员函数,
    procedure TIdSMTP.Send(AMsg: TIdMessage);
    ...
      //SendCmd('Rset'); {Do not localize}多发送了一个"Rest" command 然后163的smtp服务器就会断开,只要把idsmtp.pas中的这一句(大概是241行吧),注释掉就OK了老大,开技术贴,给分~~~~~
      

  2.   

    对了,要把idsmtp.pas这个添加到你的Project中编译才行
      

  3.   

    这个原因是因为IdSMTP的成员函数,
    procedure TIdSMTP.Send(AMsg: TIdMessage);
    ...
      //SendCmd('Rset'); {Do not localize}多发送了一个"Rest" command 然后163的smtp服务器就会断开,只要把idsmtp.pas中的这一句(大概是241行吧),注释掉就OK了对了,要把idsmtp.pas这个添加到你的Project中编译才行---------------------------------------------
    已经做了,还是没有有问题
      

  4.   

    原来我在bcb中,就是这个原因就解决了..对了,你把delphi目录下的,那个idsmtp.dcu,文件删除掉,再Build试试.