Private
Public Access
cfg.use_tls was passed straight through as aiosmtplib's use_tls kwarg, which means implicit TLS -- encrypted from the first byte, port 465's convention. Port 587, what most providers (including the one that surfaced this: DreamHost) document as their primary submission port, needs STARTTLS instead -- a plaintext connection that upgrades in-band. Forcing implicit TLS against a STARTTLS-only port breaks the handshake outright: [SSL: WRONG_VERSION_NUMBER], a client TLS ClientHello sent to a server still expecting a plaintext SMTP greeting. The "Use TLS" checkbox still means "encrypt this connection" -- the fix infers which of the two negotiation modes to use from the port (465 -> implicit, everything else -> STARTTLS), matching the convention every mail client uses. start_tls is passed as an explicit requirement rather than left to aiosmtplib's opportunistic default, so a server that turns out not to support STARTTLS fails loudly instead of silently sending in plaintext despite the admin asking for encryption. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>