Fix: SMTP Port 25 mit STARTTLS (465/587 von Synology geblockt)
This commit is contained in:
parent
a666efd25f
commit
5f2c3476f9
1 changed files with 3 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue