mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2024-12-13 18:31:10 +01:00
keep new lines in html emails
This commit is contained in:
parent
2577d3704a
commit
d6602e96d7
@ -85,6 +85,14 @@ def send_templated_mail(template_name, email_context, recipients, sender=None, b
|
|||||||
|
|
||||||
email_html_base_file = os.path.join('helpdesk', locale, 'email_html_base.html')
|
email_html_base_file = os.path.join('helpdesk', locale, 'email_html_base.html')
|
||||||
|
|
||||||
|
|
||||||
|
''' keep new lines in html emails '''
|
||||||
|
from django.utils.safestring import mark_safe
|
||||||
|
|
||||||
|
html_txt = context['comment']
|
||||||
|
html_txt = html_txt.replace('\r\n', '<br>')
|
||||||
|
context['comment'] = mark_safe(html_txt)
|
||||||
|
|
||||||
html_part = loader.get_template_from_string(
|
html_part = loader.get_template_from_string(
|
||||||
"{%% extends '%s' %%}{%% block title %%}%s{%% endblock %%}{%% block content %%}%s{%% endblock %%}" % (email_html_base_file, t.heading, t.html)
|
"{%% extends '%s' %%}{%% block title %%}%s{%% endblock %%}{%% block content %%}%s{%% endblock %%}" % (email_html_base_file, t.heading, t.html)
|
||||||
).render(context)
|
).render(context)
|
||||||
|
Loading…
Reference in New Issue
Block a user