Better programmatic email generation
Allow different content for HTML vs text Automatically strip/tidy up text output
This commit is contained in:
parent
fc1bb22dc4
commit
62119cc83c
@ -87,10 +87,12 @@ class Emailer:
|
||||
def render_mail(self, template_loc, params={}):
|
||||
params['baseurl'] = 'https://' + settings.ALLOWED_HOSTS[0]
|
||||
|
||||
params['format'] = 'txt'
|
||||
template = loader.get_template(template_loc)
|
||||
content_txt = template.render(params)
|
||||
content_txt = template.render(params).strip().replace('\\*', '*')
|
||||
|
||||
content_markdown = self.markdown(content_txt)
|
||||
params['format'] = 'markdown'
|
||||
content_markdown = self.markdown(template.render(params))
|
||||
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()
|
||||
|
Loading…
Reference in New Issue
Block a user