这是代码
         memo1.Clear;
          memo1.Lines.Add(FileName);
          SMTP1.AuthenticationType := atLogin;
          SMTP1.UserId:=smtpid;    //帐号
          SMTP1.Password := smtppwd;  //密码
          SMTP1.Host := smtpip;     //服务器
          SMTP1.Port :=25;
          try
            SMTP1.Connect ;
          except
//            Showmessage('连接SMTP服务器失败!');
            Exit;
          end;
   
     
              try
                with IdMsg do
                begin
                  body.Clear;
                  Body.Assign(memo1.lines);             //付件
                  From.address :='fdf;    ///发件人
                  Recipients.EMailAddresses :=ADOQuery1.fieldbyname('email').AsString;  //收件人
                  Subject:='sdfds'                  //主题
                end;
               
                SMTP1.Send(IdMsg);
              finally
               // showmessage('您的信件已成功发送');
                SMTP1.Disconnect;
              end;
下面是提示这个错误:
  502 Error:command not implemented
网上找了很多,也没有发现解决的办法,高手们帮帮忙

解决方案 »

  1.   


    smtpid,smtppwd,smtpip在程序启动的时候就已经获取到了
      

  2.   

    因为现在用默认的设置去发邮件,很多邮箱比如新申请的163邮箱,126邮箱,都无法通过认证,需要做一些其他的工作才行,或者你的邮箱没有开发smtp服务
      

  3.   


    http://www.delphibbs.com/keylife/iblog_show.asp?xid=15796
    procedure TDMMain.DataModuleCreate(Sender: TObject);
    begin
      IdSMTP.Host     := 'SMTP.126.COM';
      IdSMTP.Username := '****';
      IdSMTP.Password := '****';
      IdSMTP.MailAgent := 'Heynoon CO.';
      IdSMTP.HeloName := 'Heynoon';
      IdSMTP.AuthenticationType := atLogin;
    end;procedure TMailThread.SendMail(const EmailAddr, Subject, Msg: string);
    begin
      FDM.IdMsg.Clear;
      FDM.IdMsg.From.Address := ****';
      FDM.IdMsg.Recipients.EMailAddresses := EmailAddr;
      FDM.IdMsg.Subject := Subject;
      FDM.IdMsg.Body.Text := Msg;  FDM.IdSMTP.Connect(cTimeoutLimit);
      try
        FDM.IdSMTP.Send(FDM.IdMsg);
      finally
        FDM.IdSMTP.Disconnect;
      end;
    end;
      
      

  4.   

    你这个应该是用 Indy下的 SMTP, 你给你的Delphi5 装一个 indy9的组件包就行了。 
      

  5.   

    要验证一下接收服务器才行,最好先用简单的163.com试一下看看,可以参照5楼的测试一下,很容易的。
      

  6.   

    怎么样判断邮箱是否支持SMTP
      

  7.   

    我的测试邮箱就是163的,还有我用的是D6自带indy
      

  8.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, IdMessage, IdBaseComponent, IdComponent,DateUtils,
      IdTCPConnection, IdTCPClient, IdMessageClient, IdSMTP;type
      TForm1 = class(TForm)
        IdSMTP1: TIdSMTP;
        IdMessage1: TIdMessage;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    begin
      try
        IdSMTP1.Host:='172.50.109.43';
        IdSMTP1.Username:='test';
        IdSMTP1.Password:='1234';
        IdSMTP1.Port:=25;
        IdSMTP1.AuthenticationType:=atLogin;
        IdSMTP1.Connect;
        IdMessage1.Recipients.EMailAddresses:='[email protected]';
        IdMessage1.From.Address:='[email protected]';
        IdMessage1.Subject:='Love mail';
        IdMessage1.Body.Text:='Dear Wife,'+#13#10+'       If you receive this Email,That is what I miss you......'+#13+#13+'Success_ju'+#13+formatdatetime('yyyy/mm/dd',Now);
        IdSMTP1.Authenticate;
        IdSMTP1.Send(IdMessage1);
        ShowMessage('@_@發送成功!');
        IdSMTP1.Disconnect;
      except
        IdSMTP1.Disconnect;
        Showmessage('@^^@發送失敗!');
        Exit;
      end;
    end;end.