>          for i:= 0 to Lista.Count-1  do   // from 0 to 1
>             begin
>                   SendMail(Lista.Strings[i]);
>             end;
> And - what am I doing wrong - this doesn't work. Sending email is like in 
> demo program.
> I have message:
> SmtpException: SMTP component not ready

Your problem is a classical one: Your are trying to use a non-blocking 
event-driven component as a blocking one.
The component will send your email in the background while your program is 
doing other things. Of course a single component can send only one mail at a 
time. When you do a loop, the first iteration start sending a mail. Then 
second iteration would also send a mail while the previous is still occuring 
and therefore you get the "component busy" error.

Instead of programming a loop, you must use the event. You simply start your 
first mail send and then do nothing until the event signaling the end of 
request os done. Then only you pick the next mail from your list and send 
it.

Using this scheme, you can go faster by user multiple component. Each one 
will send a mail without blocking the others (Note that some email servers 
limit the number of concurrent connections, so you may want to use only one 
component per destination server. Be clever !).

--
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
http://www.overbyte.be


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

Reply via email to