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 http://www.faqs.org/rfcs/rfc2821.html Also check out MailSnd demo delivered with ICS. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html > > Regards. > Carlos. -- 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