Fix: SMTP Port 25 mit STARTTLS (465/587 von Synology geblockt)

This commit is contained in:
rene 2026-05-06 20:27:40 +02:00
parent a666efd25f
commit 5f2c3476f9

View file

@ -120,10 +120,11 @@ def _send_smtp(to: str, subject: str, body: str, account: str = "partner", html:
with smtplib.SMTP_SSL(_SMTP_HOST, _SMTP_PORT, context=ctx, timeout=15) as s:
s.login(acc["user"], acc["pass"])
s.sendmail(acc["from"], [to], msg_bytes)
else:
else: # 587 oder 25 mit STARTTLS
with smtplib.SMTP(_SMTP_HOST, _SMTP_PORT, timeout=15) as s:
s.ehlo()
s.starttls(context=ctx)
if s.has_extn("starttls"):
s.starttls(context=ctx)
s.login(acc["user"], acc["pass"])
s.sendmail(acc["from"], [to], msg_bytes)
_imap_save_sent(msg_bytes, account)