Skip to content

Instantly share code, notes, and snippets.

@dbischof
Created December 20, 2013 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbischof/8060782 to your computer and use it in GitHub Desktop.
Save dbischof/8060782 to your computer and use it in GitHub Desktop.
Send django email from the command line
### %> python manage.py shell
import settings
from django.core.mail import send_mail
send_mail('This is the subject', 'Here is the message.', settings.EMAIL_HOST_USER, ['recipient@example.com'], fail_silently=False)
# or
import settings
from django.core.mail import EmailMessage
email = EmailMessage('This is the subject', 'Here is the message.', settings.EMAIL_HOST_USER, ['recipient@example.com'], headers={'Reply-To':'sender@example.com'})
email.send(fail_silently=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment