mirror of
https://github.com/anand34577/ferrum.git
synced 2026-09-17 08:05:13 +00:00
6e008bae75
net/smtp.PlainAuth refuses to send credentials unless the connection is TLS or literally "localhost" — a hardcoded stdlib guard, not something the UseTLS toggle controls. So an admin who deliberately configured a plaintext relay with a username/password (a trusted internal network) got every send rejected client-side with "authenticating: unencrypted connection" before a single byte reached the server, surfacing as a 502 from the test-notification endpoint. sendPlain now authenticates via a small unencryptedPlainAuth (PLAIN without the TLS-or-localhost check) instead of smtp.PlainAuth — used only on the explicitly-no-TLS path; the STARTTLS and implicit-TLS paths keep the normal stdlib guard. Covered by a new test against an in-process fake SMTP server that verifies the AUTH PLAIN payload actually reaches the server over a real, non-localhost loopback connection.