我写了一断用TidSMTP发邮件的代码,能够连接SMTP服务器,但是在调用      Fsend.Send(Femail);的
时候会报错,TOM的邮件服务器报的是我没被授权使用<From:[email protected]>
我们公司的邮件服务器报的错误是“Need RCPT first”
我的代码是:
begin
 try
   try
             FSend.Username:='*****';
       FSend.Host :='*****';
       FSend.Port :=25;        FSend.Password :='*****';
        Femail.From.Text :=FSend.Username ;
        Femail.ReceiptRecipient.Address := FSend.Username;
        Femail.Subject :='邮件测试';
        Femail.Body.Text :='测试测试测试';      Fsend.Connect;
      Fsend.Send(Femail);
      application.MessageBox('发送成功','成功',MB_ok);
   Except
      Fsend.DisconnectSocket ;
      Fsend.Disconnect ;
      application.MessageBox('连接SMTP服务器出现错误','错误',MB_ICONERROR);
      exit;
   end;
finally
  Fsend.DisconnectSocket ;
  Fsend.Disconnect ;
end;
end;

解决方案 »

  1.   

    FSend.Username:='*****';
            FSend.Password :='*****';
            FSend.Host :='*****';
            FSend.Port :=25;
            FSend.AuthenticationType := atLogin;        Femail.From.Text := '你的邮件地址';
            Femail.ReceiptRecipient.Address := '接收邮件地址';
            Femail.Subject :='邮件测试';
            Femail.Body.Text :='测试测试测试';      Fsend.Connect;
          Fsend.Send(Femail);
      

  2.   

    不行,我的FSend空件里面设了FSend.AuthenticationType := atLogin;
      

  3.   

    我也是跟他一样的错误,不过我把你说的改了.就是:IdSMTP.AuthenticationType := atLogin;那么我想问一下这段代码是起什么作用,为什么不改成这样的就发不出去?我在这里先谢谢这个仁兄了.
      

  4.   

    没人知道IdSMTP.AuthenticationType 这个属性是做什么用的吗?郁闷!
      

  5.   

    IdSMTP.AuthenticationType 发送时要验证密码