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.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/27210#comment:1>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/27210#comment:2>
* owner: nobody => Vesteinn Snaebjarnarson
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/27210#comment:3>
* has_patch: 0 => 1
Comment:
See pull request at https://github.com/django/django/pull/7281
Added ConnectionError to the exception tuple for the SMTPBackend with
tests.
--
Ticket URL: <https://code.djangoproject.com/ticket/27210#comment:4>
* needs_better_patch: 0 => 1
Comment:
Please uncheck "Patch needs improvement" when review comments are
addressed and tests are passing.
--
Ticket URL: <https://code.djangoproject.com/ticket/27210#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"602bffe7585c6b61f3d9badf21f84c1eb445d58f" 602bffe7]:
{{{
#!CommitTicketReference repository=""
revision="602bffe7585c6b61f3d9badf21f84c1eb445d58f"
Fixed #27210 -- Allowed SMTPBackend to fail silently on a socket
connection error.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27210#comment:6>
Comment (by GitHub <noreply@…>):
In [changeset:"f6fe8ecc10a3d88470e25fe6ebc61122154653f0" f6fe8ecc]:
{{{
#!CommitTicketReference repository=""
revision="f6fe8ecc10a3d88470e25fe6ebc61122154653f0"
Refs #27210 -- Fixed isolation of test_fail_silently_on_connection_error.
The test wouldn't pass if a mail server is running on the system.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27210#comment:7>