fix(smtp_relay): upgrade to STARTTLS before AUTH if server advertises it

Servers like mail.resacachile.cl only expose AUTH after STARTTLS. Issue
starttls() + re-ehlo() when the server advertises the extension.
This commit is contained in:
2026-04-30 12:40:17 -04:00
parent 633594b110
commit 4d12fb6a03

View File

@@ -50,6 +50,9 @@ def forward_probe(
try:
with smtplib.SMTP(upstream_host, upstream_port, timeout=15) as conn:
conn.ehlo()
if conn.has_extn("STARTTLS"):
conn.starttls()
conn.ehlo()
if upstream_user and upstream_pass:
conn.login(upstream_user, upstream_pass)
conn.sendmail(envelope_from, rcpt_to, body)