Requires Django 1.4 and higher (officially supported 1.4 / 1.7 / 1.8 / 1.9)
Django mail queue backend. Allows for putting email in specific queues to be sent out in batches (via a management command), editing emails from the admin and more.
Add mcfeely to your INSTALLED_APPS settings:
INSTALLED_APPS = ( 'mcfeely', )
django-mcfeely supplies its own email backend that you must add to your settings.py file. This stores all the information needed to create an email at sendtime in the database.
EMAIL_BACKEND = 'mcfeely.backend.DbBackend'
For basic queueing with only a default queue (usefull if you just want to delay sending of emails) there is no other configuration required. django-mcfeely will work out of the box with djangos built in send_mail function.
from django.core.mail import send_mail
send_mail('Subject here', 'Here is the message.', '[email protected]',
['[email protected]'], fail_silently=False)
This will only place mail in the "Default" queue. If you want to place email into defined queues you have to use mcfeely's custom send_mail function
django-mcfeely provides its own send_mail function that can be used to place emails into custom queues.
from mcfeely.models import Queue
from mcfeely.mail import send_mail
mail_queue = Queue.objects.get(queue='sample_queue')
send_mail('Subject here', 'Here is the message.', '[email protected]',
['[email protected]'], queue=mail_queue, fail_silently=False)
Or you can pass it the name of a queue instead.
from mcfeely.mail import send_mail
send_mail('Subject here', 'Here is the message.', '[email protected]',
['[email protected]'], queue='sample_queue', fail_silently=False)
Queued Mail is sent via a management command
python manage.py send_queue <queue_name>