Hello Max, it has been a while I worked with TSmtpCli. Try to post a message from OnSessionClosed to custom message handler. The message hander take car of next connection.
--- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz Saturday, July 29, 2006, 15:06, Max Terentiev wrote: > Hello Wilfred, > But how I can detect that SmtpCli->Abort() is finished, component is > ready and I can call SmtpCli->Connect again for next message ? If I call SmtpCli->>Connect() IMMEDIATELY after SmtpCli->Abort() > I should receive "Component Not Ready" error, right ? If SmtpCli->>Abort() is called only OnSessionClose event is triggered > (OnRequestDone NOT triggered in this case). > So, to start new sessuion I must use OnSessionClose in case of Smtp protocol > error/Abort and OnRequestDone in case of successfull sending (no Abort) ? > --- > With best regards, Max Terentiev. > Business Software Products. > AMS Development Team. > [EMAIL PROTECTED] > ----- Original Message ----- > From: "Wilfried Mestdagh" <[EMAIL PROTECTED]> > To: "ICS support mailing" <twsocket@elists.org> > Sent: Saturday, July 29, 2006 2:04 PM > Subject: Re: [twsocket] Best event to start new Smtp session >> Hello Max, >> >> Use OnRequestDone to trigger next sending, not OnStateChange or >> OnSessionClosed. Both latter are more for log or display updates. >> >> --- >> Rgds, Wilfried [TeamICS] >> http://www.overbyte.be/eng/overbyte/teamics.html >> http://www.mestdagh.biz >> >> Saturday, July 29, 2006, 11:48, Max Terentiev wrote: >> >>> Helo, >> >>> What is a best event for starting new Smtp session (e.g. >>> start sending next message after previous is sent or aborted)? >> >>> I was try to Use OnSessionClosed or OnStateChange events >>> (in OnStateChange i wait for SmtpCli->State==smtpReady and >> Smtp->>CtrlSocket->State=wsClosed). >> >>> But anyway i receive folowing errors time to time: >> >>> 1. Smtp component not ready >>> 2. Error in function WSACancelAsyncRequest - Invalid Argument >>> 3. Smtp component already connected >>> 4. Can't change socks port if not closed. >> >>> This errors happens time to time (program can work minutes or hours >>> before >>> it). >> >>> I not understand why it's happens ? >> >>> After sending message (or getting smtp protocol error during sending >>> message) I ALWAYS Call SmtpCli->Abort() and wait in OnStateChange >>> until connection closed and component is ready. After it I prepare next >>> message and call SmtpCli->Connect(), etc. >> >>> Why I receive errors 1-4 ?? Maybe I must do something special ? How i >>> can ensure what connection is 100% closed and component 100% ready for >>> next >>> session ? >> >>> I NOT use Application->ProcessMessages inside SmtpCli events. >> >>> Please help... And excuse me for bad english. >> >>> --- >>> With best regards, Max Terentiev. >>> Business Software Products. >>> AMS Development Team. >>> [EMAIL PROTECTED] >> >> >> -- >> 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 >> -- 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