Answer the question
In order to leave comments, you need to log in
Django how to send a template email?
I send emails like this:
from django.core import mail
email = mail.EmailMessage('Hello', 'Body goes here', '[email protected]',
['[email protected]'], connection=connection)
Answer the question
In order to leave comments, you need to log in
from django.template.loader import render_to_string
print render_to_string('tpl.html', {})
from django.core.mail import EmailMessage
def custom_send_email(to_list, subject, message, sender="Ololo <[email protected]>"):
msg = EmailMessage(subject, message, sender, to_list)
msg.content_subtype = "html" # Main content is now text/html
return msg.send()
We use this thing https://pypi.python.org/pypi/django-db-mailer very conveniently
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question