You must have setuptools installed.

From PyPI:

pip install django_mailqueue_backend

Or download a package from the PyPI or the BitBucket page:

pip install <package>

Or unpack the package and:

python install.


Django >=1.7 and its dependencies.

If you want to use a queue server you should install the following:

queue-front >= 0.7.2 located at: or Note that queue-front also has dependencies. See this page for more details.

If you want to use the uwsgi spool you should install the following:

uwsgidecorators at:


In your Django file insert the following in an appropriate place:



# for a queue server using queue-front
EMAIL_BACKEND = "mailqueue_backend.mail.smtp.QueuedEmailBackend"
# for a the uwsgi spool
EMAIL_BACKEND = "mailqueue_backend.mail.smtp_wsgi.SpooledEmailBackend"

If you are using a queue server make sure queue-front is setup and you should run the following command by any regular means that you prefer (cron, celery, etc):

./ process_mail_queue

If you are using the uwsgi spool make sure you have a spool running and be sure to include mailqueue_backend.spool_wsgi in your spool.

Mail Storage

If you are using a queue server the mail is stored there. The backend for the queue is specified by you in the queue-front app.

If you are using the uwsgi spool the mail will be stored in the spool location you specified in your uwsgi configuration.


This module has been tested with the following: (Note that python 3.0 compatibility is dependent on the backend queue you choose to use with the queue-front dependency.)

  • python 2.7 django 1.7
  • python 3.3 django 1.7
  • python 3.4 django 1.7
  • python 2.7 django 1.8
  • python 3.3 django 1.8
  • python 3.4 django 1.8
  • python 2.7 django 1.9
  • python 3.4 django 1.9
  • python 3.5 django 1.9



Logging can be configured for this module using the module settings (below) or by defining logging settings in the django settings module. The loggers in this module have the following names:

  • smtp.mail_process_queue for failure messages
  • smtp.mail_spool for if you use the uwsgi spool
  • smtp.mail_queue for if you use the queue-front backend

Packages Security

This module, when packaged, is signed with the following key:

Mario Rosa's Key with id 0x8EBBFA6F (full fingerprint F261 96E4 8EF2 ED4A 26F8 58E9 04AA 48D1 8EBB FA6F) and his email is

You can find this key on servers like

Additional Settings


Default: 86400 (Integer) aka 1 day

The amount of time in seconds until a failed email is discarded from the queue.


Default: LOG_DIR setting if available or ''

Directory to log status messages.


Default: "smtp.mail_queue.mail_queue_fail.log"

A log to this file will be made when a message is discarded.


Default: 5 (Integer)

Number (n) of files in log rotation. A new backup is created once MAXBYTES is reached in the current log file up to n many log files. The oldest log file is deleted on rotation (i.e. n+1).


Default: 5242880 (Integer) aka 5MB

Maximum size of a log file.


Default: False

Set to true if you want this application to rotate log files, or keep False if your logs are rotated by another application.


Default: "MAIL_QUEUE"

Set the name of the queue.


Default: "smtp.mail_queue.process_queue.log"

Log file for the process_mail_queue management command.


Default: "smtp.mail_queue.process_spool.log"

Log file for the uwsgi spool.