#27210: SMTPBackend does not honor fail_silently=True when receiving a socket
level
connection error
-----------------------------+--------------------
Reporter: whyscream | Owner: nobody
Type: Bug | Status: new
Component: Core (Mail) | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------
The Python SMTPlib does not wrap connection errors that occur on socket
level while setting up a connection. That means that Django needs to catch
socket errors too (@here:
https://github.com/django/django/blob/master/django/core/mail/backends/smtp.py#L73)
when `fail_silently` is enabled and the connection fails with a
`socket.error` (f.i.: Connection refused) or `socket.timeout` (f.i.
Connection timed out).
I tested this by setting up a django 1.10 with following settings:
{{{
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'localhost'
EMAIL_PORT = 10587 # nothing is listening here!
}}}
Then I copied the core admincommand `sendtestemail.py` to one of my apps,
and modified
https://github.com/django/django/blob/master/django/core/management/commands/sendtestemail.py#L34
to set `fail_silently=True`. This should yield no error, but it ends in a
Traceback.
Original problem of this issue for me was the
`utils.log.AdminEmailHandler` that uses this feature. I can try to create
some test cases for this issue when the issue is deemed valid.
--
Ticket URL: <https://code.djangoproject.com/ticket/27210>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.38ed4fa31833fb6bea4be47d4f647b78%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.