Start of the mail backend for djrill.

This commit is contained in:
Chris Jones
2012-01-20 16:59:15 -08:00
parent b18b3ced46
commit fd04e60171
4 changed files with 39 additions and 0 deletions

0
djrill/mail/__init__.py Normal file
View File

View File

View File

@@ -0,0 +1,36 @@
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.mail.backends.base import BaseEmailBackend
class DjrillBackend(BaseEmailBackend):
"""
Mandrill API Email Backend
"""
def __init__(self, fail_silently=False, **kwargs):
"""
Set the API key, API url and set the action url.
"""
super(DjrillBackend, self).__init__(**kwargs)
self.api_key = getattr(settings, "MANDRILL_API_KEY", None)
self.api_url = getattr(settings, "MANDRILL_API_URL", None)
if not self.api_key:
raise ImproperlyConfigured("You have not set your mandrill api key "
"in the settings.py file.")
if not self.api_url:
raise ImproperlyConfigured("You have not added the Mandrill api "
"url to your settings.py")
self.api_action = self.api_url + "/messages/send.json"
def open(self):
"""
Ping the Mandrill API to make sure they are up
and that we have a valid API key and sender.
"""
pass
def send_messages(self, email_messages):
pass

View File

@@ -24,6 +24,9 @@ DATABASES = {
MANDRILL_API_KEY = None
MANDRILL_API_URL = "http://mandrillapp.com/api/1.0/"
#EMAIL BACKEND
EMAIL_BACKEND = "djrill.mail.backends.djrill.DjrillBackend"
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name