From 58678b4504a5573eb093315020d54737bb3e486a Mon Sep 17 00:00:00 2001 From: Shyam Sunder Date: Wed, 2 Dec 2020 14:01:02 -0500 Subject: [PATCH] server/func/mailer: Attempt to manually start TLS for SMTP Fixes #365 --- server/szurubooru/func/mailer.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/szurubooru/func/mailer.py b/server/szurubooru/func/mailer.py index c4cf9db..0fe35ac 100644 --- a/server/szurubooru/func/mailer.py +++ b/server/szurubooru/func/mailer.py @@ -13,6 +13,10 @@ def send_mail(sender: str, recipient: str, subject: str, body: str) -> None: smtp = smtplib.SMTP( config.config["smtp"]["host"], int(config.config["smtp"]["port"]) ) + try: + smtp.starttls() + except smtplib.SMTPNotSupportedError: + pass smtp.login(config.config["smtp"]["user"], config.config["smtp"]["pass"]) smtp.send_message(msg) smtp.quit()