mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-25 22:22:26 +00:00
Also catch ConnectionError when sending mails
This commit is contained in:
parent
fa95625205
commit
cd097cd428
2 changed files with 2 additions and 2 deletions
|
@ -50,7 +50,7 @@ def send_mail(mail, request):
|
||||||
"""Wrapper for Django's EmailMessage.send which handles errors"""
|
"""Wrapper for Django's EmailMessage.send which handles errors"""
|
||||||
try:
|
try:
|
||||||
mail.send()
|
mail.send()
|
||||||
except SMTPException as e:
|
except (SMTPException, ConnectionError) as e:
|
||||||
if request:
|
if request:
|
||||||
messages.error(
|
messages.error(
|
||||||
request,
|
request,
|
||||||
|
|
|
@ -36,7 +36,7 @@ def send_mail(request, *args, **kwargs):
|
||||||
try:
|
try:
|
||||||
kwargs["fail_silently"] = request is None
|
kwargs["fail_silently"] = request is None
|
||||||
django_send_mail(*args, **kwargs)
|
django_send_mail(*args, **kwargs)
|
||||||
except SMTPException as e:
|
except (SMTPException, ConnectionError) as e:
|
||||||
messages.error(
|
messages.error(
|
||||||
request,
|
request,
|
||||||
_("Failed to send email: %(error)s.") % {
|
_("Failed to send email: %(error)s.") % {
|
||||||
|
|
Loading…
Reference in a new issue