终于又用回Delphi!! 
不知道为什么IDSMTP的控件连接啥主机都是10061,试过很多163,sohu,21cn,sina等,都一样 
就用indy的demo程序也一样,换mail2000的控件还是一样 
不知道因为什么原因那?     idSMTP1.Host   :=edhost.Text   ;       //SMTP服务器地址 
    idSMTP1.AuthenticationType   :=atLogin;       //需要认证。若不需要,设置为atNone,即不需要Username和Password   
    idSMTP1.Username   :=eduser.Text   ;   //用户名,即你在此服务器上的账号   
    idSMTP1.Password   :=edpwd.Text   ;     //密码   
    idSMTP1.MailAgent   := "Kendy的邮件发送器 ";       //定义自己的邮件程序名,显示在信头里   
    with   Msg   do         //通过idMessage组件来封装邮件内容   
        begin   
            Body.Assign(memobody.Lines);     //邮件内容   
            From.Text   :=edfrom.Text   ;           //发件人地址 
            Recipients.EMailAddresses   :=edto.Text   ;     //收件人地址 
            Subject   :=edsub.Text   ;       //邮件标题   
        end;   
      try   
          try 
              idSMTP1.Connect(2000);       //连接服务器,如果2秒内没连上,将触发相应的错误事件 
              idSMTP1.Send(Msg);       //发送邮件   
          except   
              begin 
                  memo2.Lines.Add( " > >   发送失败 ");     //没连上服务器触发的错误事件   
                  exit;   
              end;   
          end;   
      finally   
          idSMTP1.Disconnect   ;   //断开服务器。SMTP协议要求断开服务器后才表示邮件被发送   
      end;   

解决方案 »

  1.   

      10061       Connection   is   forcefully   rejected.(连接被强行拒决)是否服务器不对?
      

  2.   

    smtp.163.com
    smtp.21cn.com
    smtp.sina.com应该没什么不对吧
    不知道为什么,可能时本地网络的问题吧
    我用outlook设置连接163的信箱也连不上,可能什么原因那?
    telnet smtp.163.com 25 能正常连上
      

  3.   

        idSMTP1.Host:= "smtp.163.com ";
        idsmtp1.Port:=25;
        idSMTP1.AuthenticationType:=atLogin;
        idSMTP1.Username:= "hongqi162 ";
        idSMTP1.Password:= "mypwd ";
        idSMTP1.MailAgent:=   "Kendy的邮件发送器   ";
        with   Msg   do
        begin
            Body.Assign(memobody.Lines);
            From.Text:= "[email protected] ";
            Recipients.EMailAddresses:= "[email protected] ";
            Subject:= "fdasfdsa ";
        end;
        try
            try
                idSMTP1.Connect(2000);
                idSMTP1.Send(Msg);
            except
            begin
                memo2.Lines.Add(   "   >   >       发送失败   ");
                exit;
            end;
        end;
        finally
            idSMTP1.Disconnect;
        end;找到idsmtp实现单元找到Send方法将SendCmd( "RSET ");注释掉
    procedure   TIdSMTP.Send(AMsg:   TIdMessage);
    ....
    begin
        //SendCmd( "RSET ");         这句注释掉
        if   NeedToAuthenticate   then   begin
            Authenticate;
        end;
    ....在你project所在文件夹中新建一个文件夹,将C:\Program   Files\Borland\Delphi7\Source\Indy下的IdMessageClient.pas,IdSMTP, IdMessageCoderMIME.pas   这两个文件copy到这个新建的文件夹中,在IDE中打开Project- >Options- >Directories/Conditionals- >Search   path中加入这个新建的文件夹所在的路径,重新编译就可以了。
    我测试已经通过了,可以在邮箱里找到刚刚发送的邮件
    发件人 主题 日期 大小

    日期 : 今天
    未读普通 未分类 我 fdasfdsa 10:58 898B
      

  4.   

    需要的话留下邮箱我把demo发给你
      

  5.   

    [email protected]我还是疑问
    错误出现在 IDSMTP1.connect()这句上
    还没到send那里,你改Send有用?
      

  6.   

    我停用防火墙也是一样
    再说如果是防火墙拦截,我想应该telnet也不行吧
      

  7.   

    谢谢你的demo程序,跟我的程序一样的问题
    应该是我这边的环境问题吧
    只是不知道怎么解决
      

  8.   

    你换一台机器试一下,我用的是xp sp2系统 瑞星防火墙 delphi7
      

  9.   

    呵呵,我把机器上的杀毒软件给卸载了就可以了
    准备换个norton试试。奇怪的事情,我结贴的时候为什么老提示我输入密码不正确
    我明明输入了正确的密码,能登陆进来
      

  10.   

    好几天我在delphi版没得分了,估计就是这个原因
      

  11.   

    raised exception class EIdSocketError with message 'Sockket Error # 10061 Connection refused.'.
    我的是这样。啥意思哈?
    新手
    看不懂。
    希望得到帮助