[Django] #24419: Testing email settings

24 views
Skip to first unread message

Django

unread,
Feb 26, 2015, 12:27:12 PM2/26/15
to django-...@googlegroups.com
#24419: Testing email settings
-------------------------------+--------------------
Reporter: gavinwahl | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (Mail) | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
When configuring django to send emails through an SMTP server, there are
usually many different settings to try to get it to work. I've written a
management command that just sends an email to make testing the settings
easier. I'm wonder if there's any interest in including this command in
django?

Here's the command: https://github.com/fusionbox/django-
fusionbox/blob/master/fusionbox/core/management/commands/send_test_email.py

--
Ticket URL: <https://code.djangoproject.com/ticket/24419>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 26, 2015, 12:53:33 PM2/26/15
to django-...@googlegroups.com
#24419: Testing email settings
-------------------------------+--------------------------------------

Reporter: gavinwahl | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (Mail) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by collinanderson):

* cc: cmawebsite@… (added)
* needs_docs: => 0
* needs_tests: => 0
* needs_better_patch: => 0


Comment:

The django developers list is usually the best place to discuss new
features.

My thoughts on your code:
- If you set from_email=None, it should pick up the defaults
automatically.
- fail_silently defaults to False.

Maybe it would be more useful to try to mimic the unix mail/sendmail
commands, so you can use it even for non testing situations.

--
Ticket URL: <https://code.djangoproject.com/ticket/24419#comment:1>

Django

unread,
Feb 26, 2015, 1:13:46 PM2/26/15
to django-...@googlegroups.com
#24419: Testing email settings
-------------------------------+--------------------------------------
Reporter: gavinwahl | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (Mail) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by timgraham):

I don't see much advantage to a management command compared to opening a
shell and invoking `send_mail()` as you see fit (besides saving some
keystrokes).

--
Ticket URL: <https://code.djangoproject.com/ticket/24419#comment:2>

Django

unread,
Mar 3, 2015, 10:46:13 AM3/3/15
to django-...@googlegroups.com
#24419: Provide an easy way to test email connection
-----------------------------+------------------------------------
Reporter: gavinwahl | Owner: nobody
Type: New feature | Status: new

Component: Core (Mail) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by timgraham):

* type: Uncategorized => New feature
* stage: Unreviewed => Accepted


Comment:

From the [https://groups.google.com/d/topic/django-
developers/A3IKxAtAqtc/discussion mailing list thread]:

Russ: "However, the counterpoint to that is that you can't just reload
settings, so you have to retype (or rely on command history). I agree the
benefit is marginal, but I think it's a nice enough convenience, and it's
not going to be a major maintenance overhead, so I think it's probably
worth including."

aRkadeFR: "But if I take a step back, these commands (for my projects) are
only here to test that my SMTP settings are well setup. Thus, the test
sending email is quite unnecessary, I would like a check that connects to
the SMTP server (if the emails settings are setup else do nothing) when
the application starts. (I don't know if there's something like saying to
a SMTP server: am I allowed here? without sending an actual email)"

Tom (reply to aRkadeFR): "In Simple Mail Transfer Protocol terms, it
definitely is (EHLO, MAIL FROM, RCPT TO, then disconnect without sending
DATA). But SMTP is not the only mail backend, and smptlib does not expose
that level of connection detail - it will merely raise a different
exception type if any of those commands do not return 250 status."

--
Ticket URL: <https://code.djangoproject.com/ticket/24419#comment:3>

Django

unread,
Mar 7, 2015, 8:11:40 AM3/7/15
to django-...@googlegroups.com
#24419: Provide an easy way to test email connection
-----------------------------+-------------------------------------
Reporter: gavinwahl | Owner: gannetson
Type: New feature | Status: assigned

Component: Core (Mail) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------+-------------------------------------
Changes (by gannetson):

* owner: nobody => gannetson
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/24419#comment:4>

Django

unread,
Mar 7, 2015, 9:08:29 AM3/7/15
to django-...@googlegroups.com
#24419: Provide an easy way to test email connection
-----------------------------+-------------------------------------
Reporter: gavinwahl | Owner: gannetson
Type: New feature | Status: assigned
Component: Core (Mail) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------+-------------------------------------
Changes (by gannetson):

* has_patch: 0 => 1


Comment:

Please review https://github.com/django/django/pull/4263

--
Ticket URL: <https://code.djangoproject.com/ticket/24419#comment:5>

Django

unread,
Mar 7, 2015, 9:29:47 AM3/7/15
to django-...@googlegroups.com
#24419: Provide an easy way to test email connection
-----------------------------+-------------------------------------
Reporter: gavinwahl | Owner: gannetson
Type: New feature | Status: assigned
Component: Core (Mail) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------+-------------------------------------

Comment (by timgraham):

Did you consider the comments from the mailing list thread about testing
SMTP settings only without sending a mail? If it's feasible and not too
difficult, I find that a bit more useful than simply duplicating
`send_mail()`.

--
Ticket URL: <https://code.djangoproject.com/ticket/24419#comment:6>

Django

unread,
Mar 9, 2015, 5:07:18 AM3/9/15
to django-...@googlegroups.com
#24419: Provide an easy way to test email connection
-----------------------------+-------------------------------------
Reporter: gavinwahl | Owner: gannetson
Type: New feature | Status: assigned
Component: Core (Mail) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------+-------------------------------------

Comment (by gannetson):

Something like this throws an error when SMTP creds are wrong:

{{{
from django.core import mail
from django.core.mail.backends.smtp import EmailBackend

def _check_mail_settings(self):
connection = mail.get_connection()
if isinstance(connection, EmailBackend):
connection.open()
}}}

But I think this should be a new ticket/feature. This ticket, to me, is
really about sending an actual mail. Could I propose a new ticket to
create `testconnections` (like @imgraham suggested) that's to test other
connections (cache, ...) as well?

--
Ticket URL: <https://code.djangoproject.com/ticket/24419#comment:7>

Django

unread,
Mar 20, 2015, 12:04:24 PM3/20/15
to django-...@googlegroups.com
#24419: Provide an easy way to test email connection
-----------------------------+-------------------------------------
Reporter: gavinwahl | Owner: gannetson
Type: New feature | Status: closed

Component: Core (Mail) | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"d898ba1bec588450d591ebd5076993f96d05eb24" d898ba1b]:
{{{
#!CommitTicketReference repository=""
revision="d898ba1bec588450d591ebd5076993f96d05eb24"
Fixed #24419 -- Added sendtestemail management command
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24419#comment:8>

Reply all
Reply to author
Forward
0 new messages