Coder Social home page Coder Social logo

markijbema / django-email-html Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ramusus/django-email-html

2.0 2.0 1.0 271 KB

Application for switching from Django plain-text emails to html emails with 2 bodies: html and plain-text, generated automatically from html

Python 100.00%

django-email-html's Introduction

This application can be used for quickly switching all emails of site from plain-text to html. For using it you need to do 2 steps:

* add ``email_html`` to ``INSTALLED_APPS`` higher, then other third-part applications;
* change email templates to 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 one: 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 is generating automatically basing on html body;
* from_email attribute is not required. By default it will be equal to ``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 cam be used:

    send_mail(subj, html, recipient_list=emails)

Requirements:

* BeautifulSoup
* w3m (for generating plain-text from html)

Important things:

* Place ``email_html`` application in ``INSTALLED_APPS`` before all other applications, which sending emails, that you need to make html based by default;
* Html body must contains <html> tag, otherwise function would think this is a plain-text body;

django-email-html's People

Contributors

markijbema avatar ramusus avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

jouwstraat

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.