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

- **ID:** `communication/smtp-connection-timeout-port-587`
- **Domain:** communication
- **Category:** network_error
- **Error Code:** `ETIMEDOUT`
- **Verification:** ai_generated
- **Fix Rate:** 80%

## 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.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Postfix 3.7.0 | active | — | — |
| Exim 4.96 | active | — | — |
| sendmail 8.17.1 | active | — | — |

## Workarounds

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

## Dead Ends

- **** — Port 587 is blocked by firewall; longer timeout doesn't bypass firewall (90% fail)
- **** — Telnet also fails if port is blocked; doesn't solve the underlying issue (95% fail)
- **** — Port 25 may be blocked by ISPs or flagged as spam; also insecure (70% fail)
