lalin wrote:
> Hello,
>     I use SMTPClient for sending a email since a server with default
> smtp server of IIS. The example program find this smtp server. But in
> my program, with this code:   Smtp1.Host := smtpserver;   Smtp1.port
> := 'smpt';   Smtp1.FromName := name;
>   Smtp1.HdrFrom  := mail1;
>   Smtp1.HdrTo    := mail2;
>   Smtp1.HdrSubject := title;
>   Smtp1.Connect;
>   Smtp1.Data;
>   Smtp1.quit;
>     produces "SMTP component not ready". Can you help me?

There are at least two errors in your code.
1) TSmtpCli is async, means a request i.e. method Connect 
returns at once even though the component is not yet connected.
Later an event (OnRequestDone) is triggered instead when the
request completed. Any subsequent SMTP method must be called
from an event handler, this is mostly done in OnRequestDone.
In the handler you check error code and RQType parameters to
know what to do next. 

2) When Connect completes sucessfully the order of calling
subsequent methods could be i.e. Ehlo, MailFrom, RcptTo, Data, Quit.

To learn how SMTP works see RFC2821
Also check out MailSnd demo delivered with ICS.

Arno Garrels [TeamICS]


> Regards.
> Carlos.
To unsubscribe or change your settings for TWSocket mailing list
please goto
Visit our website at

Reply via email to