是否可以将SMPT连接保持打开状态以接收多条消息?

时间:2019-02-04 23:12:38

标签: email delphi indy10

我读了博客https://www.indyproject.org/2008/01/16/new-html-message-builder-class/

我设法以纯文本和HTML +图片格式发送邮件。

在执行以下代码后,我注意到该帐户的登录过程很慢。问题是。每个邮件都需要登录吗?如何在Delphi Berlin中做到这一点?

谢谢

procedure SendMails
begin

    Set_Account;   // read data account
    Set_iniMail;   // Set message Text / html
    Set_SMTP;      // create and set SMTP
    GetDataMails;  // query data mails destination

    if not dm.qryData.Active then
        exit;

    try
        IdSMTP1.Connect;
        IdSMTP1.Authenticate;

        while not dm.qryData.Eof do
        begin
            SetMail_1;     // Set destination

            if fMailHtml_1 <> '' then
                SendHTML;              

            if fMailTxt_1 <> '' then
                SendTextPlane;
        end {while}

    finally
        dm.qryData.close;
        IdSMTP1.Disconnect;
    end;

end;

procedure SendHTML;
begin
  ..
  SMTP1.Send(IdMessage1);   // Error Connection Close Gracefully
  ..
end;

0 个答案:

没有答案