Report SMTP error with more info
All checks were successful
docker-image / docker (push) Successful in 3m38s
All checks were successful
docker-image / docker (push) Successful in 3m38s
This commit is contained in:
parent
5d950facab
commit
1fc917bdf5
|
@ -60,11 +60,18 @@ class EmailSender:
|
||||||
:param message: to be sent
|
:param message: to be sent
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
smtp_server = smtplib.SMTP(self.hostname, port=self.port)
|
try:
|
||||||
context = ssl.create_default_context()
|
smtp_server = smtplib.SMTP(self.hostname, port=self.port)
|
||||||
smtp_server.starttls(context=context)
|
context = ssl.create_default_context()
|
||||||
smtp_server.login(self.username, self.password)
|
smtp_server.starttls(context=context)
|
||||||
smtp_server.send_message(message)
|
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}')
|
||||||
|
raise e
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f'EmailSender<{self.hostname},{self.port},{self.username},{self.mail_from}>'
|
||||||
|
|
||||||
|
|
||||||
class HedgedocExpire:
|
class HedgedocExpire:
|
||||||
|
|
Loading…
Reference in a new issue