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.
* 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>
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>
* 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>
* owner: nobody => gannetson
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/24419#comment:4>
* has_patch: 0 => 1
Comment:
Please review https://github.com/django/django/pull/4263
--
Ticket URL: <https://code.djangoproject.com/ticket/24419#comment:5>
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>
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>
* 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>