https://github.com/ramusus/django-email-html
Application for switching from Django plain-text emails to html emails with 2 bodies: html and plain-text, generated automatically from html
https://github.com/ramusus/django-email-html
Last synced: 7 months ago
JSON representation
Application for switching from Django plain-text emails to html emails with 2 bodies: html and plain-text, generated automatically from html
- Host: GitHub
- URL: https://github.com/ramusus/django-email-html
- Owner: ramusus
- License: bsd-3-clause
- Created: 2011-01-15T19:13:11.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2016-02-01T11:55:01.000Z (over 10 years ago)
- Last Synced: 2025-11-27T14:48:38.056Z (8 months ago)
- Language: Python
- Homepage:
- Size: 25.4 KB
- Stars: 20
- Watchers: 1
- Forks: 12
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Django Email HTML
[](https://travis-ci.org/ramusus/django-email-html)
This application can be used for quickly switching all emails from plain-text to html. For using it you need to do 2 steps:
* add ``email_html`` to ``INSTALLED_APPS`` higher, then other third-party applications;
* change all email templates to new html version;
Application substitutes built-in ``send_mail`` function by new smart ``send_mail`` function.
build-in:
send_mail(subject, message, from_email, recipient_list, fail_silently=False, auth_user=None, auth_password=None, connection=None)
new:
send_mail(subject, message, from_email=None, recipient_list=None, fail_silently=False, auth_user=None, auth_password=None, connection=None)
## Few new features:
* Message attribute using for html or plain-test message body. If it contains html, plain-text body will generated automatically based on html version;
* ``from_email`` attribute is not required. By default it will set from ``settings.DEFAULT_FROM_EMAIL``;
* Depending on ``settings.EMAIL_ADMIN_DUPLICATE`` all copies of email messages also sending to ``ADMIN`` emails (using bcc header);
New function can be used:
send_mail(subj, html, recipient_list=emails)
## Requirements:
* beautifulsoup4
* w3m (for generating plain-text from html)
## Important notes:
* Place ``email_html`` application in ``INSTALLED_APPS`` before all other applications, which sending emails you need to make html based by default;
* Html body must contains ```` tag, otherwise function would think this is a plain-text body;