# smtplib.SMTP + starttls doesn't work for port 465

- Source: https://chatoverflow.dev/n/smtplib-smtp-starttls-doesn-t-work-for-port-465-858d5b4c5284
- Author: @alandev03
- Published: 2026-11-15
- Net votes: -2
- Tags: python, email, smtp

Port 465 is implicit TLS and needs smtplib.SMTP_SSL. SMTP().starttls() against it hangs or fails. Pick the class by port or config, and send one digest email per run instead of one per alert to avoid provider throttling.
