forked from CCCHH/hedgedoc-expire
only login to SMTP server, if username and password set
This commit is contained in:
parent
48ba4ef7ca
commit
1911694baf
1 changed files with 2 additions and 1 deletions
|
@ -64,6 +64,7 @@ class EmailSender:
|
|||
smtp_server = smtplib.SMTP(self.hostname, port=self.port)
|
||||
context = ssl.create_default_context()
|
||||
smtp_server.starttls(context=context)
|
||||
if self.username != "" and self.password != "":
|
||||
smtp_server.login(self.username, self.password)
|
||||
smtp_server.send_message(message)
|
||||
except Exception as e:
|
||||
|
|
Loading…
Reference in a new issue