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

前端 未结 1 1446
孤独总比滥情好
孤独总比滥情好 2021-01-28 10:13

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

1条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-28 11:11

    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;
    

    0 讨论(0)
提交回复
热议问题