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!

A reusable Django app for controlling queuing and sending of app emails

Project Description

A reusable Django app for controlling queuing and sending of app emails. Key use case is to move sending of emails out of requests to speed-up request time and help to solve problems with sending email, handling deferring of email and logging of app email communication.

App started as a fork of Derek Stegelman’s Django Mail Queue and heavilly inspired by James Tauber’s django-mailer.

Any feedback, issues and suggestions are welcome. In that case please use Bitbucket’s issues.

Key features

  • Emails are queued and send as asynchronous task with help of Celery or Huey or as a crontab job scheduler.
  • With use of own backend easily integrated into existing app.
  • Easily configurable to use different mail backends as Django’s SMTP backend or Amazon SES using Sea Cucumber.


Install django_queue_mailer:

$ pip install django_queue_mailer

Add the following to your

# Add django_queue_mailer to INSTALLED_APPS

# Add django_queue_mailer's backend
EMAIL_BACKEND = "django_queue_mailer.backend.DbBackend"

# Setup email backend for sending queued emails
DJANGO_QUEUE_MAILER_EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"

# Or other backed as Sea Cucumber
DJANGO_QUEUE_MAILER_EMAIL_BACKEND = "seacucumber.backend.SESBackend"

You need to create the necessary tables. If you use south, just run migrations:

$ python migrate django_queue_mailer

If not, normal syncdb will do. For easier package upgrades using south for database migrations is strongly recommended.

$ python syncdb

Basic usage

Send emails and put them in queue with Django’s send_mail function:

from django.core.mail import send_mail

send_mail('Subject here', 'Here is the message.', '',
    [''], fail_silently=False)

Alternatively you can queue message with use of Queue model:

from django_queue_mailer.models import Queue

new_message = Queue()
new_message.subject = "Testing subject"
new_message.to_address = ","
new_message.bcc_address = ""
new_message.from_address = ""
new_message.content = "Mail content"
new_message.html_content = "<h1>Mail Content</h1>" = "someapp"

Queued messages can be send with use of Celery as asynchronous tasks. Example of Celery task, in your app folder:

from django_queue_mailer.models import Queue

def send_mail():

Huey is a perfect lightweight Celery alternative. Example of using it’s multi-threaded tasks, periodical or event based (called from request when needed). Configure task in

from huey.djhuey import task, periodic_task, crontab
from import call_command

def send_mail():

Simplest solution is to run crontab job, configure crontab using crontab -e:

*/2 * * * * path-to-virtualenv/bin/python path-to-app-folder/ send_queued_messages

Further documentation

Will be added.

Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_queue_mailer-0.1.7.tar.gz (12.2 kB) Copy SHA256 Checksum SHA256 Source Mar 23, 2015

Supported By

WebFaction WebFaction Technical Writing 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 Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting