【问题标题】:How to send several emails in a single connection of IdSMTP?如何在单个 IdSMTP 连接中发送多封电子邮件?
【发布时间】:2019-06-19 08:16:06
【问题描述】:

我在 C++Builder 6.0 专业版上使用 Indy 10。

我的 SMTP 服务器对特定时间间隔内的连接数施加了限制,因此我需要使用同一连接发送多封电子邮件。可能吗?我该怎么做?

我已经能够连接并在每次连接时发送一封电子邮件。

非常感谢您的帮助。

【问题讨论】:

    标签: ssl smtp indy


    【解决方案1】:

    您可以在一对Connect()/Disconnect() 调用之间多次调用TIdSMTP.Send(),根据需要为每个Send() 调用调整TIdMessage

    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;
    

    【讨论】:

    • 我可以为每封电子邮件使用一个新的 TIdMessage 吗?我想在发送之前准备好所有电子邮件。非常感谢您回答我。
    • @JaymeJeffman 是的,您每次都可以使用一个新的TIdMessage。或者,您也可以每次只需 Clear() 一个 TIdMessage
    猜你喜欢
    • 2012-09-03
    • 2014-08-31
    • 2011-02-08
    • 1970-01-01
    • 2016-07-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多