Commits

Gregory Haskins committed d38d507

Added setting specifying task queue to use for sending mail (EMAIL_QUEUE_NAME)

  • Participants
  • Parent commits 4e8ccc9
  • Branches mailfix

Comments (0)

Files changed (2)

 
     def _defer_message(self, message):
         from google.appengine.ext import deferred
-        deferred.defer(_send_deferred, message, fail_silently=self.fail_silently)
+        from django.conf import settings
+        queue_name = getattr(settings, 'EMAIL_QUEUE_NAME', 'default')
+        deferred.defer(_send_deferred, 
+                       message, 
+                       fail_silently=self.fail_silently,
+                       _queue=queue_name)
 
 class AsyncEmailBackend(EmailBackend):
     can_defer = True
 else:
     EMAIL_BACKEND = 'djangoappengine.mail.EmailBackend'
 
+# Specify a queue name for the async. email backend
+EMAIL_QUEUE_NAME = 'default'
+
 PREPARE_UPLOAD_BACKEND = 'djangoappengine.storage.prepare_upload'
 SERVE_FILE_BACKEND = 'djangoappengine.storage.serve_file'
 DEFAULT_FILE_STORAGE = 'djangoappengine.storage.BlobstoreStorage'