Created
January 17, 2011 12:34
-
-
Save danielroseman/782801 to your computer and use it in GitHub Desktop.
Queue email backend for Django
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.mail.backends.base import BaseEmailBackend | |
from utils.publish import publish_to_queue | |
class QueueBackend(BaseEmailBackend): | |
def send_messages(self, email_messages): | |
for i, email in enumerate(email_messages): | |
msg = email.__dict__ | |
msg.pop('connection', None) | |
publish_to_queue(msg, 'mail.send') | |
return i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment