procedure TForm1.Button1Click(Sender: TObject);
begin
  with IdMessage1 do
  begin
    idmessage1.AddHeader('大家好,我是太阳');
    Body.Text:='Test mail here';
    From.Text:='[email protected]';
    Recipients.EMailAddresses :='[email protected]';
    Subject:='大家好,我是太阳';
  end;
  try
    idsmtp1.Send(idmessage1);
    MessageDlg('邮件传送成功!', mtInformation, [mbOK], 0);
  finally
    IdSMTP1.Disconnect;
  end;
end;procedure TForm1.Button2Click(Sender: TObject);
begin
  idsmtp1.Host:=edt_smtp.Text;
  idsmtp1.Port:=strtoint(edt_port.Text);
  idsmtp1.Username:=edt_name.Text;
  idsmtp1.Password:=edt_pass.Text;
  idsmtp1.AuthenticationType:=atLogin;
  idsmtp1.Connect;
  MessageDlg('连接成功!', mtInformation, [mbOK], 0);
  //idsmtp1.Authenticate;
end;我在点击BUTTON1时.总会提醒我。AUTHENTICATION FAILED
请高手指点指点

解决方案 »

  1.   

    那可能是因为你的邮件服务器需要身份验证,而你按Button1时并没有发送密码给服务器。
      

  2.   

    是不是你的SMTP主机需要身份认证呀!
    你换一个不需要身份认证的主机试试吧。李战.深圳
      

  3.   

    我用的是www.elong.com的服务器。它的确是需要身份验证,但是idsmtp控件是可以解决这个主机身份认证的问题啊。还望指教
      

  4.   

    u code no problem!!!i use u code to test, it work good!!!
      

  5.   

    你的问题可以在
    http://www.nevrona.com/indy中下载demo,里边找到一个mailclient的例子的代码,看看就知道了。