Well something like this exists in my code. Some functions are my own but I
think you get the picture. 

procedure TLCInheritSMTPDM.SmtpRequestDone(Sender: TObject;
  RqType: TSmtpRequest; ErrorCode: Word);
begin
  if (error > 0) then
  begin
    logMsg('Service Error occured RqType:'+inttostr(integer(RqType))+'
Error:'+vartostr(error));
    Exit;
  end;

  if RqType = smtpConnect then
  begin
    logMsg('Recived: smtpConnect, Sending HELO');
    Smtp.Helo
  end
  else
  if RqType = smtpOpen then
  begin
    logMsg('Recived: smtOpen, sending MailFrom');
    Smtp.MailFrom;
  end
  else
  if RqType = smtpHelo then
  begin
    logMsg('Recived: smtpHelo, Sending from');
    Smtp.MailFrom;
  end
  else
  if RqType = smtpMailFrom then
  begin

    logMsg('Recived: smtpMailFrom, Sending to');
    Smtp.RcptTo;

  end
  else
  if RqType = smtpRcptTo then
  begin

    logMsg('Recived: smtpRcptTo, Sending data');
    Smtp.Data;

  end
  else
  if RqType = smtpData then
  begin

    logMsg('Recived: smtpData, Data sent');

    //Are there any e-mail to send?

    if hasMail2send then
    begin

      logMsg('Sending next email');

      //generate email to send here, set all values et.c.

      Smtp.MailFrom;

    end
    else
    begin
      logMsg('No more email to send, quitting.');
      Smtp.Quit
    end



  end
  else
  if RqType = smtpQuit then
  begin
    logMsg('SMTP connection closed, restarting timer...');
    
    SendTimer.Enabled := True;
  end;

end;

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of SoftTech
Sent: den 28 juli 2008 22:37
To: ICS support mailing
Subject: Re: [twsocket] TSmtpCli - How do I process multiple emails
usingthiscomponent?

Greetings Francois,

Thanks for your reply.  I have looked at the article and am guessing the 
best place to loop thru a database to send out mass e-mail would be in the 
OnRequestDone event.  Would that be correct?  Does anyone have any code they

can share of this event to show how they processed records in a database?

Thanks,
Mike


----- Original Message ----- 
From: "Francois PIETTE" <[EMAIL PROTECTED]>
To: "ICS support mailing" <twsocket@elists.org>
Sent: Monday, July 28, 2008 11:08 AM
Subject: Re: [twsocket] TSmtpCli - How do I process multiple emails 
usingthiscomponent?


> You are trying to use an asynchronous (non-blocking) component as a
> synchronous (blocking) one.
> The solution is simple: think asynchronous, think events !
> Have a look there:
> http://wiki.overbyte.be/wiki/index.php/Asynchronous_Paradigm
> Then come back here to ask for more questions...
>
> --
> [EMAIL PROTECTED]
> The author of the freeware multi-tier middleware MidWare
> The author of the freeware Internet Component Suite (ICS)
> http://www.overbyte.be
>
>


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to