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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user