Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Send emails from the command line using Django's settings

Project Description

# Email Command for Django

This app provides a simple management command for sending emails using your Django settings from the command line.

## Install

Pull down the app:

$ pip install django-send-email

Add it to your `INSTALLED_APPS`:


## Sending Emails

django-send-email provides a management command named `send_email_message` to send emails from the command line.

$ send_email_message subject message

Subject, message and at least one recipient are required. You can pass `ADMINS` or `MANAGERS` as any one of the recipients and django-send-email will fetch the recipients from the proper Django setting.

$ send_email_message subject message MANAGERS --bcc=ADMINS

You can also pass a filename as the message argument and django-send-email will use the file contents at the body of the email.

$ send_email_message subject /path/to/message.txt

Alternatively you can use `-` as the message argument to read from standard input.

$ send_email_message subject - < /path/to/message.txt
$ echo "some message text" | send_email_message subject -

### Full Usage

Usage: send_email_message [options] <subject> <message or file or "-"> <recipient1>...<recipientN>

Sends an email to the specified email addresses.
Message can be a string, filename or "-" to read from stdin.

Verbosity level; 0=minimal output, 1=normal output,
2=verbose output, 3=very verbose output
--settings=SETTINGS The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't provided, the
DJANGO_SETTINGS_MODULE environment variable will be
A directory to add to the Python path, e.g.
--traceback Print traceback on exception
--noinput Tells Django to NOT prompt the user for input of any
Email address to use to send emails from. Defaults to
-r, --raise-error Exceptions during the email sending process will be
raised. Default to failing silently
-n, --noprefix Disables email subject prefix. Default behavior is to
prepend settings.EMAIL_SUBJECT_PREFIX
-b BCC, --bcc=BCC Comma separated list of email addresses for BCC
-c CC, --cc=CC Comma separated list of email addresses for CC
--version show program's version number and exit
-h, --help show this help message and exit

## Testing

Running the unittests is as simple as testing any other Django app test django_send_email

To test the command on a development SMTP server, you can run the debug SMTP server from the `smtp` library.

$ python -m smtpd -n -c DebuggingServer localhost:1025

Just make sure that Django is configured correctly to point at localhost:1025

Release History

This version
History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(5.8 kB) Copy SHA256 Hash SHA256
Source None Jun 15, 2015

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers