Host/Username/Port/Password
我都填了,怎么就连不上??

解决方案 »

  1.   

    将AuthenticationType属性置为AtLogin.
      

  2.   

    有DEMO呢,http://www.nevrona.com/indy有下载。
      

  3.   

    用Delphi7上控件 TidMessage,TidSMTP来发送电子邮件(编写:雨中太阳):
    定义变量
      UserEmail:string;//收件人邮件地址
      SmtpAuthType:integer;//验证
      SmtpServerUser:string;//登陆SMTP服务器的用户名
      SmtpServerPassword:string;//登陆SMTP服务器用到的密码
      SmtpServerName:string;//SMTP服务器名.例如:smtp.sohu.com
      SmtpServerPort:integer;//SMTP服务器端口,默认的是25
    以下是发送过程.其中idMsgSend:TidMessage,SMTP:TidSMTP;分别在Indy Clients和Indy Misc页上.
    procedure TForm1.BitBtn1Click(Sender: TObject);
    begin
       with IdMsgSend do
          begin
             Body.Assign(Memo1.Lines);
             From.Text := '[email protected]';                         //发件人
             ReplyTo.EMailAddresses :=UserEmail ;
             Recipients.EMailAddresses :=UserEmail; { To: header }//收件人地址
             Subject := 'kkkkkkkkkkk'; { Subject: header } //邮件主体
    //         Priority := TIdMessagePriority(cboPriority.ItemIndex); { Message Priority } //邮件优先级
    //         CCList.EMailAddresses := edtCC.Text; {CC}           //抄送
    //         BccList.EMailAddresses := edtBCC.Text; {BBC}        //暗送
             if chkReturnReciept.Checked then                    //需要已读回执
                begin {We set the recipient to the From E-Mail address }
                   ReceiptRecipient.Text := From.Text;
                end
             else
                begin {indicate that there is no receipt recipiant}
                   ReceiptRecipient.Text := '';
                end;
          end;  authentication settings                 //是否需要验证
       case SmtpAuthType of
          0: SMTP.AuthenticationType := atNone;
          1: SMTP.AuthenticationType := atLogin; {Simple Login }
       end;  
       SMTP.Username := SmtpServerUser;
       SMTP.Password := SmtpServerPassword;   {General setup}
       SMTP.Host := SmtpServerName;
       SMTP.Port := SmtpServerPort;   {now we send the message}
       SMTP.Connect;
      
       try
          SMTP.Send(IdMsgSend);
          showmessage('发送成功!');
       finally
          
          SMTP.Disconnect;
          showmessage('发送失败!');
       end;
    end;