Created
September 1, 2014 12:48
-
-
Save hirokazumiyaji/00137875ffd26836556a to your computer and use it in GitHub Desktop.
Amazon SES using 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
# coding: utf-8 | |
from boto import ses | |
from django.conf import settings | |
class EMail(object): | |
def __init__(self): | |
self._connection = ses.connect_to_region( | |
settings.SES['REGION'], | |
aws_access_key_id=settings.SES['ACCESS_KEY'], | |
aws_secret_access_key=settings.SES['SECRET_KEY']) | |
def send(self, source, subject, body, to_addresses, **kwargs): | |
return self._connection.send_email( | |
source, | |
subject, | |
body, | |
to_addresses, | |
cc_addresses=kwargs.get('cc_addresses', []), | |
bcc_addresses=kwargs.get('bcc_addresses', []), | |
format=kwargs.get('format', 'text'), | |
reply_addresses=kwargs.get('reply_addresses', []), | |
return_path=kwargs.get('return_path'), | |
text_body=kwargs.get('text_body'), | |
html_body=kwargs.get('html_body')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment