mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 11:51:05 -05:00
Start of the mail backend for djrill.
This commit is contained in:
0
djrill/mail/__init__.py
Normal file
0
djrill/mail/__init__.py
Normal file
0
djrill/mail/backends/__init__.py
Normal file
0
djrill/mail/backends/__init__.py
Normal file
36
djrill/mail/backends/djrill.py
Normal file
36
djrill/mail/backends/djrill.py
Normal 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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user