ETIMEDOUT communication network_error ai_generated true

SMTP 连接超时:连接到 smtp.example.com 端口 587 超时

SMTPConnectionTimeout: timed out connecting to smtp.example.com on port 587

ID: communication/smtp-connection-timeout-port-587

其他格式: JSON · Markdown 中文 · English
80%修复率
88%置信度
1证据数
2024-01-10首次发现

版本兼容性

版本状态引入弃用备注
Postfix 3.7.0 active
Exim 4.96 active
sendmail 8.17.1 active

根因分析

防火墙或网络策略阻止了到端口 587(STARTTLS)的出站连接,而端口 25 或 465 可能开放,或者 SMTP 服务器因 DNS 或路由问题无法访问。

English

Firewall or network policy blocks outbound connections to port 587 (STARTTLS) while port 25 or 465 may be open, or the SMTP server is unreachable due to DNS or routing issues.

generic

官方文档

https://www.rfc-editor.org/rfc/rfc3207

解决方案

  1. Switch to port 465 with implicit SSL/TLS: import smtplib; server = smtplib.SMTP_SSL('smtp.example.com', 465); server.login(user, password); server.sendmail(from_addr, to_addrs, msg)
  2. Contact network administrator to open outbound port 587 in firewall rules
  3. Use a relay server on a different port (e.g., 2525) if provider supports it

无效尝试

常见但无效的做法:

  1. 90% 失败

    Port 587 is blocked by firewall; longer timeout doesn't bypass firewall

  2. 95% 失败

    Telnet also fails if port is blocked; doesn't solve the underlying issue

  3. 70% 失败

    Port 25 may be blocked by ISPs or flagged as spam; also insecure