summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorShyam Sunder <sgsunder1@gmail.com>2020-12-02 14:01:02 -0500
committerShyam Sunder <sgsunder1@gmail.com>2020-12-02 14:01:43 -0500
commit58678b4504a5573eb093315020d54737bb3e486a (patch)
tree0e8d196d8de686145b35c74477d460e120419eaf /server
parent59452711668b9f7a7aeea3c57301b22882987c2b (diff)
server/func/mailer: Attempt to manually start TLS for SMTP
Fixes #365
Diffstat (limited to 'server')
-rw-r--r--server/szurubooru/func/mailer.py4
1 files changed, 4 insertions, 0 deletions
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()