29d3e8984b
The cabinet email service called smtplib.SMTP() and conditionally ran starttls() regardless of port, which is wrong for port 465. Port 465 is SMTPS (implicit TLS, RFC 8314): the TLS handshake must happen on connect, before any EHLO. With the old code, switching to 465 produced a corrupted handshake — sometimes one garbled message went through, then the server dropped the source. Now SMTP_SSL is used when SMTP_USE_SSL is true OR when SMTP_PORT is 465 (auto-detect). The new SMTP_USE_SSL setting defaults to false to keep existing 587/25 deployments unchanged.