You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

18 lines
566 B

from django.conf import settings
from django.core.mail import send_mail
from django.template.loader import render_to_string
def send(to, template_directory, ctx):
""" Send HTML email using Mandrill.
Expect template_directory to be a path containing
- subject.txt
- body.html
"""
from_email = settings.DEFAULT_FROM_EMAIL
subject = render_to_string("%s/subject.txt" % template_directory, ctx)
body = render_to_string("%s/body.html" % template_directory, ctx)
send_mail(subject, "", from_email, [to], html_message=body)