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


----- Original Message ----- 
From: "SoftTech" <[EMAIL PROTECTED]>
To: "ICS support mailing" <twsocket@elists.org>
Sent: Monday, July 28, 2008 5:41 PM
Subject: [twsocket] TSmtpCli - How do I process multiple emails using 
thiscomponent?


> Greets All,
>
> I need to loop thru a database and process several emails.  I first setup 
> the default settings for the SmtpCli component, then later in my code I 
> loop thru data in a dataset as shown below.  My problem is it will only 
> process the first email in the dataset, then when it gets to the "Connect" 
> command a second time I get an error: 'SMTP component not ready'.  What 
> did I forget to do or do wrong?
>
> Here is my code:
>      with dtmProcessEmails.cdsEmail do
>        begin
>          First;
>
>          while not EOF do
>            begin
>              with dtmProcessEmails.SmtpCli do
>                begin
>                  FromName := dtmProcessEmails.cdsEmailEMAIL_FROM.AsString; 
> // Actual from email address
>                  HdrFrom := recUser.CompanyName;
>                  HdrTo := dtmProcessEmails.cdsEmailEMAIL_TO.AsString;
>                  HdrReplyTo := '[EMAIL PROTECTED]';
>                  HdrSubject := 
> dtmProcessEmails.cdsEmailEMAIL_SUBJECT.AsString;
>
>                  //* Recipient list is computed from To, Cc and Bcc fields
>                  RcptName.Clear;
>                  RcptNameAdd(dtmProcessEmails.cdsEmailEMAIL_TO.AsString, 
> '', '');
>
>                  Display('Connecting to SMTP server...');
>
>                  { Start first operation to do to send an email          }
>                  { Next operations are started from OnRequestDone event  }
>                  Connect;
>                end;
>
>              barProgressBar.IncPartsByOne;
>
>              Next;
>            end;
>        end;
> -- 
> 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