发163网易的信提示 bad sequence of commands
发其他的,如tom的则成功。
费解~
:(代码:
  smtp用的是tidsmtp (indy组件)
   with IdMsgSend do
      begin
         Clear;
         Body.Clear;         Body.Add(dbmemo1.Text);         From.Text := UserEmail;
         Recipients.EMailAddresses := trim(dbeditex1.Text) ; { To: header }
         Subject := trim(dbeditex3.Text) ; { Subject: header }
         Priority := TIdMessagePriority(mpNormal); { Message Priority }
         //CCList.EMailAddresses := edtCC.Text; {CC}
         // BccList.EMailAddresses := edtBCC.Text; {BBC}  抄送,暗抄        /// 附件 :
         for i:=0 to listview2.Items.Count -1 do
         begin
          TIdAttachment.Create(IdMsgSend.MessageParts,
             listview2.Items[i].SubItems.Strings[1]);
         end;
          if chkReturnReciept.Checked then
            begin  
               ReceiptRecipient.Text := From.Text;
            end
           else
            begin  
               ReceiptRecipient.Text := '';
            end;      end; // idsendmsg     
     case   SmtpAuthType of
     0:
     SMTP.AuthenticationType :=atnone ;
     1:
     SMTP.AuthenticationType :=atLogin ;
     end;
     
     SMTP.Username   := SmtpServerUser;
     SMTP.Password := SmtpServerpassword ;   
     SMTP.Host := SmtpServerName;
     SMTP.Port := SmtpServerPort;
 
 
    if not smtp.Connected then
     SMTP.Connect;     if  radiobutton1.Checked then
     begin
      gressbar(listview1.Items.Count,'正在发送邮件...');
      SMTP.Send(IdMsgSend);
      gresspos(10);
      gressrelease;
     end;

解决方案 »

  1.   

    function TFBillPrint.SendMailWithAttachments(ToMail, Subject: string; Filename, AliasName: string; BeXls: boolean=true): boolean;
    var
      mmNew: TIdMessage;
      smtpNew: TIdSMTP;
      attNew: TIdAttachment;
    begin
      Result := true;
      smtpNew := TIdSMTP.Create(Self);
      smtpNew.UserId := 'xxx';
      smtpNew.Password := 'xxx';
      smtpNew.Host := 'SMTP.SINA.COM.CN';
      smtpNew.AuthenticationType := atLogin;
      smtpNew.Port := 25;
      mmNew := TIdMessage.Create(Self);
      mmNew.From.Address := [email protected]';
      mmNew.Subject := Subject;
      mmNew.Recipients.Add.Address := ToMail;
      mmNew.Body.Text := '请您查收。';
      attNew := TIdAttachment.Create(mmNew.MessageParts,FileName);
      attNew.FileName := AliasName;
      Try
        try
          smtpNew.Connect;
          smtpNew.Send(mmNew);
        except
          Result := FALSE;
        end;
      finally
        if smtpNew.Connected then
          smtpNew.Disconnect;
        attNew.Free;
        mmNew.Free;
        smtpNew.Free;
      end;
    end;
      

  2.   

    故障依旧用tom的smtp服务器可以发送,而用 163的smtp.163.com,用户,密码分别也是163的却出错!!故障依旧
      

  3.   

    哈哈,撒分indy9.0版本可能就是有此bug
    我用10.00的以后就没问题了,呵呵,就是这么简单,不过tattachment已经变成基类了
    TIdAttachment.Create 要变成 TIdAttachmentfile.Create就这么简单。
      

  4.   

    这不是indy9的bug,同样的程序,2005年还能正常使用的,2006年网易的就不能发邮件了,可能把indy9的当作是垃圾邮件了,郁闷!到现在还没找到解决方法!
      

  5.   

    找到原因了,问题出在
    procedure TIdSMTP.Send(AMsg: TIdMessage);这个函数里
    将SendCmd('RSET');    {Do not Localize}这行注销就可以了原来是没问题的,可能是那些邮件服务器的验证顺序改了,或者是专门针对INDY而做的修改!可恶!
      

  6.   

    改了上面的地方虽然发送的时候不报错了,但还是发送不了,那些可恶的邮件服务器还做了专门的验证,如果是indy控件发过来的邮件一律拒绝!
    虽然这个帖子已经结贴,但为了使其他人能够找到解决方法,我还是将我的解决方法贴上来,
    除了要改上面提到的那个地方外,还要改IdMessageCoderMIME这个单元,将下面的常量IndyMIMEBoundary,IndyMultiPartAlternativeBoundary,IndyMultiPartRelatedBoundary改成你自己需要的就可以了。
    从这里可以看出,部门门户网站的免费邮箱专门针对indy组件做了限制!现在borland已经决定出售delphi了,这些门户还暗地里捅上一刀,真是阴险!