diff options
| author | Loek van Gent <loek@1procentclub.nl> | 2015-03-07 13:55:59 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-03-20 12:03:50 -0400 |
| commit | d898ba1bec588450d591ebd5076993f96d05eb24 (patch) | |
| tree | 04d40bad0735180546fbc8f0eb7bec3fd2cd3b2a /django | |
| parent | 55f12f8709f0604df7e1817a4c114ead1fb9a311 (diff) | |
Fixed #24419 -- Added sendtestemail management command
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/management/commands/sendtestemail.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/django/core/management/commands/sendtestemail.py b/django/core/management/commands/sendtestemail.py new file mode 100644 index 0000000000..c0284bb95f --- /dev/null +++ b/django/core/management/commands/sendtestemail.py @@ -0,0 +1,20 @@ +import datetime +import socket + +from django.core.mail import send_mail +from django.core.management.base import BaseCommand, CommandError + + +class Command(BaseCommand): + help = "Sends a test email to the email addresses specified as arguments." + args = "<email1 email2 ...>" + + def handle(self, *args, **kwargs): + if not args: + raise CommandError('You must provide at least one destination email.') + send_mail( + subject='Test email from %s on %s' % (socket.gethostname(), datetime.datetime.now()), + message="If you\'re reading this, it was successful.", + from_email=None, + recipient_list=args, + ) |
