ETIMEDOUT communication network_error ai_generated true

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

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

Also available as: JSON · Markdown · 中文
80%Fix Rate
88%Confidence
1Evidence
2024-01-10First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Postfix 3.7.0 active
Exim 4.96 active
sendmail 8.17.1 active

Root Cause

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

中文

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

Official Documentation

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

Workarounds

  1. 90% success 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)
    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. 80% success Contact network administrator to open outbound port 587 in firewall rules
    Contact network administrator to open outbound port 587 in firewall rules
  3. 75% success Use a relay server on a different port (e.g., 2525) if provider supports it
    Use a relay server on a different port (e.g., 2525) if provider supports it

中文步骤

  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

Dead Ends

Common approaches that don't work:

  1. 90% fail

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

  2. 95% fail

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

  3. 70% fail

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