NMSMTP不会烂到这个份上吧?(100分)

  • 主题发起人 主题发起人 Kent
  • 开始时间 开始时间
K

Kent

Unregistered / Unconfirmed
GUEST, unregistred user!
就这么一段代码:

if NMSMTP1.Connected = False then
NMSMTP1.Connect;

NMSMTP1.PostMessage.FromAddress := From_Address;
NMSMTP1.PostMessage.FromName := 'aaa';
NMSMTP1.PostMessage.Subject := Mail_Subject;
NMSMTP1.PostMessage.ToAddress.Clear;
RichEdit1.Lines.Add(Mail_Subject);
NMSMTP1.PostMessage.ToAddress.Add(Attack_Target);
NMSMTP1.PostMessage.Body.Clear;
NMSMTP1.PostMessage.Body.Assign(form7.memo1.lines);

For i:=1 to Mail_Attack_Time do
begin
NMSMTP1.SendMail;
end;

NMSMTP1.Disonnect;

运行时出错,什么"503 bad sequences of commands",是我程序有问题吗?
 
应该先确定连接
if NMSMTP1.Connected = true then
begin
NMSMTP1.PostMessage.FromAddress := From_Address;
NMSMTP1.PostMessage.FromName := 'aaa';
NMSMTP1.PostMessage.Subject := Mail_Subject;
NMSMTP1.PostMessage.ToAddress.Clear;
RichEdit1.Lines.Add(Mail_Subject);
NMSMTP1.PostMessage.ToAddress.Add(Attack_Target);
NMSMTP1.PostMessage.Body.Clear;
NMSMTP1.PostMessage.Body.Assign(form7.memo1.lines);
NMSMTP1.SendMail;
end;
循环发送可能还应该在OnSendStart里标记是否上次发送已完成或正在发送,
并在在OnSuccess和OnFailureEvent里把标记清除
为什么循环发送?别吓我

 
hehe,写个炸弹玩玩...
 
呵呵,NMXXX的确够破,而且没有源码
劝你还是换个ICS或者sakemail比较好
 
TNMSMTP 的 ClearParams 属性缺省为true,
当其为true时,SendMail完成后自动清除你原来设置
的PostMessage里面的属性,因此第二次sendmail出错
 
Email:variant;
Email := CreateOleObject('cdonts.newmail');
Email.From := EmailFromAddress;
Email.To := EmailAddr;
Email.Subject := EmailSubject;
Email.Body := EmailBody;
Email.AttachFile := Attechment;
Email.Send;
 
Kent:如果你还要继续讨论请定期提前你的帖子,如果不想继续讨论请结束帖子。
 
多人接受答案了。
 
后退
顶部