Office 365邮件发送readHandshakeMessages TLS错误求助
Office 365 邮件发送TLS握手失败问题排查与规则配置建议
问题概况
- 内网部分用户使用Office 365账号发送邮件时失败,其余用户无异常
- 当前使用Chilkat库版本为9.5.0.89(已解锁授权)
- 已关闭Windows防火墙,终端杀毒软件为Sophos
- 测试过25、587等SMTP端口,仍出现
readHandshakeMessagesTLS握手错误
关键日志分析
以下为失败时的Chilkat日志:
ChilkatLog: SendEmail: DllDate: Nov 28 2021 ChilkatVersion: 9.5.0.89 UnlockPrefix: AGPSFT.CB4022023 Architecture: Little Endian; 32-bit Language: ActiveX VerboseLogging: 0 Component successfully unlocked using purchased unlock code. sendEmailInner: renderToMime_pt1: createEmailForSending: Auto-generating Message-ID --createEmailForSending --renderToMime_pt1 sendMimeInner: ensureSmtpSession: ensureSmtpConnection: smtpParams: SmtpHost: smtp.office365.com SmtpPort: 25 SmtpUsername: noreply@neinorhomes.com SmtpSsl: 0 StartTLS: 0 --smtpParams smtpConnect: smtpHostname: smtp.office365.com smtpPort: 25 connectionIsReady: Need new SMTP connection --connectionIsReady smtpSocketConnect: socketOptions: SO_SNDBUF: 262144 SO_RCVBUF: 4194304 TCP_NODELAY: 1 SO_KEEPALIVE: 1 --socketOptions --smtpSocketConnect smtpGreeting: readSmtpResponse: SmtpCmdResp: 220 LO4P123CA0489.outlook.office365.com Microsoft ESMTP MAIL Service ready at Wed, 23 Nov 2022 12:33:11 +0000 --readSmtpResponse --smtpGreeting ehloCommand: sendCmdToSmtp: SmtpCmdSent: EHLO NHPTVA23<CRLF> --sendCmdToSmtp readSmtpResponse: SmtpCmdResp: 250-LO4P123CA0489.outlook.office365.com Hello [62.87.75.208] SmtpCmdResp: 250-SIZE 157286400 SmtpCmdResp: 250-PIPELINING SmtpCmdResp: 250-DSN SmtpCmdResp: 250-ENHANCEDSTATUSCODES SmtpCmdResp: 250-STARTTLS SmtpCmdResp: 250-8BITMIME SmtpCmdResp: 250-BINARYMIME SmtpCmdResp: 250-CHUNKING SmtpCmdResp: 250 SMTPUTF8 --readSmtpResponse --ehloCommand This SMTP server supports STARTTLS. Automatically doing STARTTLS... If you don't want TLS, set mailman.StartTLSifPossible equal to false (or 0) startTLS: sendCmdToSmtp: SmtpCmdSent: STARTTLS<CRLF> --sendCmdToSmtp readSmtpResponse: SmtpCmdResp: 220 2.0.0 SMTP server ready --readSmtpResponse clientHandshake: clientHandshake2: ProcessHelloRetryRequest: readHandshakeMessages: Failed to read beginning of SSL/TLS record. b: 0 dbSize: 0 nReadNBytes: 0 idleTimeoutMs: 30000 --readHandshakeMessages --ProcessHelloRetryRequest --clientHandshake2 --clientHandshake Client handshake failed. (1) connectionClosed: 1 Failed to establish TLS connection. --startTLS --smtpConnect --ensureSmtpConnection --ensureSmtpSession --sendMimeInner --sendEmailInner Failed. --SendEmail --ChilkatLog
日志核心错误点:
- 已成功建立SMTP连接并完成EHLO协商,服务器明确支持STARTTLS
- 发送STARTTLS命令后收到服务器就绪响应,但TLS握手阶段无法读取SSL/TLS记录,最终连接关闭
规则配置建议
优先配置程序规则
因为其他用户正常,说明端口本身是通的,问题出在特定进程的加密流量被拦截:
- 在Sophos中添加调用Chilkat库的应用程序到信任列表/排除项,允许其发起所有出站加密(TLS)流量
- 若无法直接添加信任,可创建针对该程序的规则:允许其与
smtp.office365.com的TCP 25/587端口建立连接,同时允许双向TLS加密数据包传输
端口规则作为补充验证
- 确认Sophos中已允许TCP 25、587端口的双向出站/入站流量(虽然其他用户正常,但部分用户可能有特殊组策略)
- 注意:端口规则覆盖范围广,无法精准定位到特定进程的问题,仅作为辅助验证手段
额外排查点
- Sophos SSL拦截检查:禁用Sophos的Web保护/SSL扫描功能测试,若恢复正常,需将
smtp.office365.com添加到SSL扫描排除列表 - Chilkat TLS版本配置:Office 365要求TLS 1.2及以上,可通过设置
mailman.SslMinVersion = 3强制启用TLS 1.2 - 用户网络环境差异:检查失败用户是否处于特定VLAN、使用代理服务器,或有其他网络设备拦截加密流量
内容的提问来源于stack exchange,提问作者user20601928
相关产品推荐
相关产品推荐

