我跟踪到控件内部如下
procedure TIdSMTP.Send(AMsg: TIdMessage);
procedure WriteRecipient(const AEmailAddress: TIdEmailAddressItem);
begin
SendCmd('RCPT TO:<' + AEMailAddress.Address + '>', [250, 251]); {Do not Localize}
end;
procedure WriteRecipients(AList: TIdEmailAddressList);
var
i: integer;
begin
for i := 0 to AList.Count - 1 do begin
WriteRecipient(AList);
end;
end;
function NeedToAuthenticate: Boolean;
begin
if FAuthenticationType <> atNone then begin
Result := IsAuthProtocolAvailable(FAuthenticationType) and (FDidAuthenticate = False);
end else begin
Result := False;
end;
end;
begin
SendCmd('RSET'); {Do not Localize}
if NeedToAuthenticate then begin
Authenticate;
end;
SendCmd('MAIL FROM:<' + AMsg.From.Address + '>', 250); {Do not Localize}
WriteRecipients(AMsg.Recipients);
WriteRecipients(AMsg.CCList);
WriteRecipients(AMsg.BccList);
SendCmd('DATA', 354); {Do not Localize}
AMsg.ExtraHeaders.Values['X-Mailer'] := MailAgent; {Do not Localize}
SendMsg(AMsg);
SendCmd('.', 250); {Do not Localize}//前面的发送都成功就这条指令报错552 CONTENE REJECT
end;