Capabilities not set during Connect

Giganews Newsgroups
Subject: Capabilities not set during Connect
Posted by:  Wynn Richardson (wy…
Date: Wed, 13 Sep 2006


I am upgrading an app from BDS2005/Indy 9 to BDS2006/Indy 10 and have
run into some trouble with the send e-mail feature that uses SMTP and
authentication.  The snippet of code that actually does the send is
pretty simple...

    IF IdSMTP.Authenticate THEN
      Result := TRUE;

However, now with BDS2006/Indy 10, an EIdSMTPReplyError exception gets
raised.  Here is what I have tracked down -- in the Authenticate method
when StartTLS is called, the check of SupportsTLS fails.  Because this
check fails, in the subsequent call of ProcessTLSNotAvail a call is made
to Disconnect which is where the exception is being raised.  In the
Disconnect call, the SendCmd of 'QUIT' is expecting a 221 response but a
250 response is actually coming back from the server.  Now, this 250
response from the server *appears* to be a remnant line from the
original Connect call.  I hooked up an IdLogFile component and here are
the contents, with some of the "good stuff" X'd out...

Stat Connected.
Recv 9/13/2006 2:22:58 PM: 220 ESMTP service ready<EOL>
Sent 9/13/2006 2:22:58 PM: EHLO XXXXX<EOL>
Recv 9/13/2006 2:22:58 PM: Hello
[XXX.XXX.XXX.XXX], pleased to meet you<EOL>
Sent 9/13/2006 2:22:58 PM: QUIT<EOL>
Recv 9/13/2006 2:22:58 PM:
104857600<EOL>250-STARTTLS<EOL>250 VRFY<EOL>

It appears what *should* be happening is in the SendGreeting method
(called from Connect) the LastCmdResult after the EHLO command should
get added to the Capabilities list.  Then Capabilities is later checked
to see if it contains STARTTLS in SupportsTLS.  After placing
breakpoints around, the LastCmdResult.Text is empty in the SendGreeting
method after the EHLO command.  You can see that the QUIT command gets
sent before the 250 response line I really want is received.

Any help or ideas would be appreciated.