How to send several emails in a single connection of IdSMTP?

十年热恋 提交于 2019-12-04 07:13:24

问题


I am using Indy 10 on C++Builder 6.0 Professional Edition.

My SMTP server imposes a limit on the number of connections in a certain time interval, so I need to send more than one email using the same connection. Is it possible? How can I do that ?

I am already able to connect and send one email on each connection.

Thank you very much for any help.


回答1:


You can call TIdSMTP.Send() multiple times between a single pair of Connect()/Disconnect() calls, adjusting the TIdMessage as needed for each Send() call.

IdSMTP1.Connect;
try
  // prepare TIdMessage as needed...
  IdSMTP1.Send(IdMessage1);

  // prepare TIdMessage as needed...
  IdSMTP1.Send(IdMessage1);

  // prepare TIdMessage as needed...
  IdSMTP1.Send(IdMessage1);
finally
  IdSMTP1.Disconnect;
end;


来源:https://stackoverflow.com/questions/54366227/how-to-send-several-emails-in-a-single-connection-of-idsmtp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!