发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;
发其他的,如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;
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;
我用10.00的以后就没问题了,呵呵,就是这么简单,不过tattachment已经变成基类了
TIdAttachment.Create 要变成 TIdAttachmentfile.Create就这么简单。
procedure TIdSMTP.Send(AMsg: TIdMessage);这个函数里
将SendCmd('RSET'); {Do not Localize}这行注销就可以了原来是没问题的,可能是那些邮件服务器的验证顺序改了,或者是专门针对INDY而做的修改!可恶!
虽然这个帖子已经结贴,但为了使其他人能够找到解决方法,我还是将我的解决方法贴上来,
除了要改上面提到的那个地方外,还要改IdMessageCoderMIME这个单元,将下面的常量IndyMIMEBoundary,IndyMultiPartAlternativeBoundary,IndyMultiPartRelatedBoundary改成你自己需要的就可以了。
从这里可以看出,部门门户网站的免费邮箱专门针对indy组件做了限制!现在borland已经决定出售delphi了,这些门户还暗地里捅上一刀,真是阴险!