Testing email settings

121 views
Skip to first unread message

Gavin Wahl

unread,
Feb 26, 2015, 12:59:22 PM2/26/15
to django-d...@googlegroups.com
I opened a ticket for this but was asked to discuss it on the mailing list.

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?

Russell Keith-Magee

unread,
Feb 26, 2015, 6:46:20 PM2/26/15
to Django Developers
Hi Gavin,

I've lost track of how many times I've written that exact code when setting up a new box - I just didn't wrap it up as a management command. There's a similar testing cycle with new cache settings.

My only concern would be the one that Tim expressed - that it's ultimately a one line shell command, so it's not a whole lot of gain. 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.

I also agree with Collin, but on a technicality. I don't think Django needs to provide a general purpose mail-sending utility that could be used in scripts; however, I *do* think that if we're going to provide a test tool, any arguments we provide should match the standard defined by existing tools like sendmail. Effectively, that probably means that someone *could* use this test tool as a general purpose command-line mail tool - but I think that's a happy accident, not a design goal.

Yours,
Russ Magee %-)



--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/910e45cf-39f1-421b-bae4-667a21069388%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

aRkadeFR

unread,
Feb 27, 2015, 4:01:57 AM2/27/15
to django-d...@googlegroups.com
Hello,

I've written couple of time similar command for my project too.

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)

Have a good day

Tom Evans

unread,
Feb 27, 2015, 2:32:54 PM2/27/15
to django-d...@googlegroups.com
On Fri, Feb 27, 2015 at 9:01 AM, aRkadeFR <con...@arkade.info> wrote:
> Hello,
>
> I've written couple of time similar command for my project too.
>
> 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)
>
> Have a good day

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.

Hey, that time spent reading RFC 821 at uni just paid off ;)

Cheers

Tom

Gavin Wahl

unread,
Mar 9, 2015, 12:44:02 PM3/9/15
to django-d...@googlegroups.com, con...@arkade.info
> 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.

This wouldn't be useful to me at all. For one, it only is defined for an SMTP backend. Also, I wouldn't trust that a successful connection means that the configuration is correct. I've seen circumstances, especially if sending through a local sendmail, that will result in a successful connection but there is still a misconfiguration. 

I expect this command to work with any email backend and to actually do a complete, end-to-end test of the configuration.

Aymeric Augustin

unread,
Mar 9, 2015, 12:49:39 PM3/9/15
to django-d...@googlegroups.com, con...@arkade.info
2015-03-09 17:44 GMT+01:00 Gavin Wahl <gavi...@gmail.com>:
I expect this command to work with any email backend and to actually do a complete, end-to-end test of the configuration.

I agree.

Another example: my SMTP provider will accept emails but put them on hold until you've validated the sender's address. Only an end-to-end test can detect this.

--
Aymeric.
Reply all
Reply to author
Forward
0 new messages