8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 03:13:12 +00:00

Also catch ConnectionError when sending mails

This commit is contained in:
Jean-Romain Garnier 2020-04-19 21:13:31 +02:00 committed by Jean-Romain Garnier
parent 1b64c8f95b
commit c0ae68490c
2 changed files with 2 additions and 2 deletions

View file

@ -50,7 +50,7 @@ def send_mail(mail, request):
"""Wrapper for Django's EmailMessage.send which handles errors"""
try:
mail.send()
except SMTPException as e:
except (SMTPException, ConnectionError) as e:
if request:
messages.error(
request,

View file

@ -36,7 +36,7 @@ def send_mail(request, *args, **kwargs):
try:
kwargs["fail_silently"] = request is None
django_send_mail(*args, **kwargs)
except SMTPException as e:
except (SMTPException, ConnectionError) as e:
messages.error(
request,
_("Failed to send email: %(error)s.") % {