From 1911694baf99b5eb51589a3c351c2cba08528357 Mon Sep 17 00:00:00 2001 From: Julian Schacher Date: Mon, 9 Dec 2024 15:15:13 +0100 Subject: [PATCH] only login to SMTP server, if username and password set --- hedgedoc-expire.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hedgedoc-expire.py b/hedgedoc-expire.py index e4c1cba..30567a3 100644 --- a/hedgedoc-expire.py +++ b/hedgedoc-expire.py @@ -64,7 +64,8 @@ class EmailSender: smtp_server = smtplib.SMTP(self.hostname, port=self.port) context = ssl.create_default_context() smtp_server.starttls(context=context) - smtp_server.login(self.username, self.password) + if self.username != "" and self.password != "": + smtp_server.login(self.username, self.password) smtp_server.send_message(message) except Exception as e: print(f'Unable to send mail through {self}: {e}')