Apply premailer to emails sent using Emailer

This commit is contained in:
Yingtong Li 2019-09-20 00:44:55 +10:00
parent 9430c4cf98
commit 9ff988d2e9
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -22,6 +22,7 @@ from django.conf import settings
from django.template import loader
from jinja2 import Markup
import logging
import markdown
# Debugging
@ -90,6 +91,8 @@ class Emailer:
content_markdown = self.markdown(content_txt)
content_html = self.template.render({'email_content': Markup(content_markdown)})
content_html = premailer.Premailer(content_html, cssutils_logging_level=logging.ERROR, strip_important=False).transform()
return content_txt, content_html
def send_mail(self, recipients, subject, template_loc, params):