In a Delphi Sports Club membership program, I send bulk emails to the members using the club's BTConnect account, which has been migrated to Office365. Recently, BT upped the authentication and I changed the SMTP parameters from satNone to satDefault and utUseExplicitTLS. If I run the program from home, it works as expected:
Stat Connected.
Recv 20/11/2012 16:36:02: 220 pod51016.outlook.com Microsoft ESMTP MAIL Service ready at Tue, 20 Nov 2012 16:36:01 +0000<EOL>
Sent 20/11/2012 16:36:02: EHLO macxp<EOL>
Recv 20/11/2012 16:36:02: 250-pod51016.outlook.com Hello [81.155.5.61]<EOL>250-SIZE 36700160<EOL>250-PIPELINING<EOL>250-DSN<EOL>250-ENHANCEDSTATUSCODES<EOL>250-STARTTLS<EOL>250-AUTH<EOL>250-8BITMIME<EOL>250-BINARYMIME<EOL>250 CHUNKING<EOL>
Sent 20/11/2012 16:36:02: STARTTLS<EOL>
Recv 20/11/2012 16:36:02: 220 2.0.0 SMTP server ready<EOL>
Sent 20/11/2012 16:36:02: EHLO macxp<EOL>
Recv 20/11/2012 16:36:02: 250-pod51016.outlook.com Hello [81.155.5.61]<EOL>250-SIZE 36700160<EOL>250-PIPELINING<EOL>250-DSN<EOL>250-ENHANCEDSTATUSCODES<EOL>250-AUTH LOGIN<EOL>250-8BITMIME<EOL>250-BINARYMIME<EOL>250 CHUNKING<EOL>
Sent 20/11/2012 16:36:02: AUTH LOGIN<EOL>
Recv 20/11/2012 16:36:02: 334 deleted<EOL>
Sent 20/11/2012 16:36:02: deleted<EOL>
Recv 20/11/2012 16:36:02: 334 deleted<EOL>
Sent 20/11/2012 16:36:02: deleted<EOL>
Recv 20/11/2012 16:36:04: 235 2.7.0 Authentication successful<EOL>
Sent 20/11/2012 16:36:04: RSET<EOL>
Recv 20/11/2012 16:36:10: 250 2.0.0 Resetting<EOL>
Sent 20/11/2012 16:36:10: MAIL FROM: <[email protected]><EOL>
Recv 20/11/2012 16:36:10: 250 2.1.0 Sender OK<EOL>
and off it goes, no problem. If I take the program to the sports club and run it there, I get this:
Stat Connected.
Recv 12/11/2012 15:17:31: 220 pod51014.outlook.com Microsoft ESMTP MAIL Service ready at Mon, 12 Nov 2012 15:17:03 +0000<EOL>
Sent 12/11/2012 15:17:31: EHLO ovscbob<EOL>
Recv 12/11/2012 15:17:31: 250-pod51014.outlook.com Hello [81.149.229.105]<EOL>250-SIZE 36700160<EOL>250-PIPELINING<EOL>250-DSN<EOL>250-ENHANCEDSTATUSCODES<EOL>250-STARTTLS<EOL>250-AUTH<EOL>250-8BITMIME<EOL>250-BINARYMIME<EOL>250 CHUNKING<EOL>
Sent 12/11/2012 15:17:31: STARTTLS<EOL>
Recv 12/11/2012 15:17:31: 220 2.0.0 SMTP server ready<EOL>
Sent 12/11/2012 15:17:31: QUIT<EOL>
Stat Disconnected.
It appears that Indy is issuing QUIT instead of the second EHLO command, but I can't find out why. I changed the setup to use satSASL and the related mechanisms, with the same result. It works fine at home, but not from the club. Is there any way I can resolve this? I updated Indy to the most recent version about a week ago as well.
Thanks
When the server receives a STARTTLS command and replies back with a success response, it expects TIdSMTP to initiate an SSL/TLS handshake before sending any further commands. In this case, the SSL/TLS handshake has to be failing, and you should be getting an exception raised. TIdSMTPBase.StartTLS() calls Disconnect() if an exception occurs. That is the only way TIdSMTP would send a QUIT command after a successful STARTTLS command, instead of sending a second EHLO.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With