vintasoftware / django-templated-email

Django module to easily send templated emails using django templates, or using a transactional mail provider (mailchimp, silverpop, etc.)
MIT License
702 stars 130 forks source link

Allow custom plain part auto processor #104

Closed gak closed 7 years ago

gak commented 7 years ago

I would like allow a custom function to convert html to text.

In my case just use html2text as django-templated-email does, but with some added configuration.

I'm working on a PR.

gak commented 7 years ago

My actual use case. I could have monkeypatched the html2text config but this seemed more flexible for your project.

def to_plain(html):
    return html2text.html2text(html, bodywidth=9999)

TEMPLATED_EMAIL_PLAIN_FUNCTION = to_plain