diff --git a/cotisations/utils.py b/cotisations/utils.py index c370fe59..5da8eee0 100644 --- a/cotisations/utils.py +++ b/cotisations/utils.py @@ -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, diff --git a/re2o/mail_utils.py b/re2o/mail_utils.py index 065a9506..86d446fb 100644 --- a/re2o/mail_utils.py +++ b/re2o/mail_utils.py @@ -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.") % {