如何在IdSMTP的单个连接中发送几封电子邮件? [英] How to send several emails in a single connection of IdSMTP?
问题描述
我在C ++ Builder 6.0 Professional Edition上使用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()
/Disconnect()
调用之间多次调用TIdSMTP.Send()
,并根据需要为每个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屋!