Created
January 11, 2013 14:18
-
-
Save jfunez/4510960 to your computer and use it in GitHub Desktop.
django send mail for managers
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 django.conf import settings | |
from django.template.loader import render_to_string | |
from mailer.models import Message | |
from mailer import PRIORITY_MAPPING | |
subject = settings.EMAIL_SUBJECT_PREFIX + u'Pending Registrations' | |
priority = PRIORITY_MAPPING['high'] | |
context = { | |
'subject': subject, | |
} | |
message_body = render_to_string('path/template_to_render_mail.html', context) | |
for manager in settings.MANAGERS: | |
Message(to_address=manager[1], | |
from_address=settings.DEFAULT_FROM_EMAIL, | |
subject=subject, | |
message_body=message_body, | |
html=True, | |
priority=priority).save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment