Skip to content

Instantly share code, notes, and snippets.

@jfunez
Created January 11, 2013 14:18
Show Gist options
  • Save jfunez/4510960 to your computer and use it in GitHub Desktop.
Save jfunez/4510960 to your computer and use it in GitHub Desktop.
django send mail for managers
# -*- 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