如何在单个 IdSMTP 连接中发送多封电子邮件? [英] How to send several emails in a single connection of IdSMTP?
本文介绍了如何在单个 IdSMTP 连接中发送多封电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 C++Builder 6.0 专业版上使用 Indy 10.
I am using Indy 10 on C++Builder 6.0 Professional Edition.
我的 SMTP 服务器对特定时间间隔内的连接数施加了限制,因此我需要使用同一连接发送多封电子邮件.是否可以?我该怎么做?
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.
非常感谢您的帮助.
推荐答案
可以在一对Connect()
之间多次调用TIdSMTP.Send()
/Disconnect()
调用,根据需要为每个 Send()
调用调整 TIdMessage
.
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;
这篇关于如何在单个 IdSMTP 连接中发送多封电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文