为什么 Outlook 仅连接到我的服务器但不发送任何电子邮件?

为什么 Outlook 仅连接到我的服务器但不发送任何电子邮件?

我没有遇到从 Gmail 或我已注册的任何邮件列表接收电子邮件的问题,但由于某种原因,Outlook 拒绝向我的邮件服务器发送任何电子邮件。

_handle_client readline: b'EHLO NAM02-BN1-obe.outbound.protection.outlook.com\r\n'                                                                                                           │
('52.100.160.208', 55618) >> b'EHLO NAM02-BN1-obe.outbound.protection.outlook.com'                                                                                                           │
('52.100.160.208', 55618) << b'250-0.0.0.0'                                                                                                                                                  │
('52.100.160.208', 55618) << b'250-SIZE 33554432'                                                                                                                                            │
('52.100.160.208', 55618) << b'250-8BITMIME'                                                                                                                                                 │
EHLO from 'NAM02-BN1-obe.outbound.protection.outlook.com'                                                                                                                                    │
('52.100.160.208', 55618) << b'250-AUTH PLAIN\n250-MAIL\n250 HELP'   

最初我以为这可能是因为 Outlook 使用 TLS 搞了些恶作剧 - 但从响应中完全删除 STARTTLS 并没有帮助。无论有没有 STARTTLS,Outook 都会连接到我的邮件服务器,发出 EHLO,然后就……放弃了?我其实不知道。

但它确实告诉我一个谎言:

1/29/2022 4:39:30 PM - Server at BYAPR05MB6069.namprd05.prod.outlook.com returned '550 5.4.317 Message expired, cannot connect to remote server(451 4.4.0
Socket error SocketError)'
1/29/2022 4:27:02 PM - Server at waynewerner.com (104.236.246.170) returned '450 4.4.317 Cannot connect to remote server [Message=451 4.4.0 Socket error
SocketError] [LastAttemptedServerName=waynewerner.com] [LastAttemptedIP=104.236.246.170:25] [BN7NAM10FT066.eop-nam10.prod.protection.outlook.com](451 4.4.0
Socket error SocketError)'

我的服务器没有返回任何450 4.4.317我在日志中看到的内容。我甚至没有在我的服务器源代码中看到任何响应是支持的. Outlook 提供https://docs.microsoft.com/en-us/microsoft-365/security/office-365-security/mail-flow-intelligence-in-office-365?view=o365-worldwide在失败邮件中,但有以下信息:

Error code: 450 4.4.317 Cannot connect to remote server

Typically, this error means Microsoft 365 connected to the destination email server, but the server responded with an immediate error, or doesn't meet the connection requirements. The error details will explain the problem. For example:

    The destination email server responded with a "Service not available" error, which indicates the server is unable to maintain communication with Microsoft 365.
    The connector is configured to require TLS, but the destination email server doesn't support TLS.

似乎 Outlook 也做了一些不正确的事情。与 Google 完全合理的方法相比:

_handle_client readline: b'EHLO mail-vk1-f175.google.com\r\n'
('209.85.221.175', 42948) >> b'EHLO mail-vk1-f175.google.com'
('209.85.221.175', 42948) << b'250-0.0.0.0'
('209.85.221.175', 42948) << b'250-SIZE 33554432'
('209.85.221.175', 42948) << b'250-8BITMIME'
('209.85.221.175', 42948) << b'250-STARTTLS'
EHLO from 'mail-vk1-f175.google.com'
('209.85.221.175', 42948) << b'250-AUTH PLAIN\n250-STARTTLS\n250 HELP'
_handle_client readline: b'STARTTLS\r\n'
('209.85.221.175', 42948) >> b'STARTTLS'
('209.85.221.175', 42948) << b'220 Ready to start TLS'
_handle_client readline: b'EHLO mail-vk1-f175.google.com\r\n'
('209.85.221.175', 42948) >> b'EHLO mail-vk1-f175.google.com'
('209.85.221.175', 42948) << b'250-0.0.0.0'
('209.85.221.175', 42948) << b'250-SIZE 33554432'
('209.85.221.175', 42948) << b'250-8BITMIME'
('209.85.221.175', 42948) << b'250-AUTH LOGIN PLAIN'
EHLO from 'mail-vk1-f175.google.com'
('209.85.221.175', 42948) << b'250-AUTH PLAIN\n250-STARTTLS\n250-MAIL\n250 HELP'
_handle_client readline: b'MAIL FROM:<[email protected]> SIZE=3159\r\n'

这里我们看到 Gmail:

  • EHLO 的
  • 获取响应,包括 STARTTLS
  • STARTTLS 的
  • 开始发送邮件

与 Outlook 相比,它只是:

  • EHLO 的
  • 没有其他的

我甚至已经仔细检查过了,看来 Outlook 此后甚至没有再发送一个字节的数据。

几分钟后,等待 Outlook 发送数据时连接似乎超时:

[2022-01-31 18:04:54,355][mail.log][INFO] ('40.107.93.71', 64992) >> b'EHLO NAM10-DM6-obe.outbound.protection.outlook.com'
[2022-01-31 18:04:54,356][mail.log][DEBUG] ('40.107.93.71', 64992) << b'250-0.0.0.0'
[2022-01-31 18:04:54,356][mail.log][DEBUG] ('40.107.93.71', 64992) << b'250-SIZE 33554432'
[2022-01-31 18:04:54,357][mail.log][DEBUG] ('40.107.93.71', 64992) << b'250-8BITMIME'
[2022-01-31 18:04:54,358][mail.log][DEBUG] ('40.107.93.71', 64992) << b'250-STARTTLS'
[2022-01-31 18:04:54,359][mail.log][DEBUG] ('40.107.93.71', 64992) << b'250-AUTH PLAIN\n250-MAIL\n250 HELP'
[2022-01-31 18:04:54,359][mail.log][DEBUG] ('40.107.93.71', 64992) reading data...
[2022-01-31 18:04:54,360][mail.log][DEBUG] ('40.107.93.71', 64992) peeking
[2022-01-31 18:09:54,356][mail.log][INFO] ('40.107.93.71', 64992) connection timeout
[2022-01-31 18:09:54,358][mail.log][INFO] ('40.107.93.71', 64992) connection lost

Outlook 可能正在寻找什么信息而我却没有提供?

答案1

事实证明,答案一直在我面前:

('209.85.221.175', 42948) << b'250-AUTH PLAIN\n250-STARTTLS\n250 HELP'

外表严格地'\r\n'在响应位之间强制执行。

这解决了我的问题

相关内容