在德尔福体育俱乐部会员计划中,我使用俱乐部的BTConnect帐户向会员发送批量电子邮件,该帐户已迁移到Office365。最近,BT提升了身份验证,我将SMTP参数从satNone更改为satDefault和utUseExplicitTLS。如果我从家里运行程序,它按预期工作:
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: <deleted@btconnect.com><EOL>
Recv 20/11/2012 16:36:10: 250 2.1.0 Sender OK<EOL>
然后关闭它,没问题。 如果我将该计划带到体育俱乐部并在那里运行,我就明白了:
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.
似乎Indy正在发出QUIT而不是第二个EHLO命令,但我找不到原因。我将设置更改为使用satSASL和相关机制,结果相同。它在家里工作得很好,但不是来自俱乐部。有什么办法可以解决这个问题吗?我也在一周前将Indy更新到最新版本。
谢谢
答案 0 :(得分:2)
当服务器收到STARTTLS
命令并以成功响应回复时,它希望TIdSMTP
在发送任何进一步的命令之前启动SSL / TLS握手。在这种情况下,SSL / TLS握手必须失败,您应该收到异常。如果发生异常,TIdSMTPBase.StartTLS()
会调用Disconnect()
。这是TIdSMTP
在成功QUIT
命令后发送STARTTLS
命令的唯一方式,而不是发送第二个EHLO
。