Enhanced email classes for Django
Project description
django-enhanced-emails
Getting started
-
Install the package:
pipenv install django-enhanced-emails
(or, with you're still using pip:pip install django-enhanced-emails
) -
Create a new email class:
from enhanced_emails import EnhancedEmail class WelcomeEmail(EnhancedEmail): subject = 'Welcome to our site!' html_template = 'emails/welcome.html'
Where
emails/welcome.html
could be:<strong>Welcome to our site {{first_name}}!</strong> Best, The OurSite team
-
Instanciate a mail and send it:
email = WelcomeEmail( to=[user.email], context={ 'first_name': user.first_name } ) email.send()
-
✨ All done! Our user received something like:
Content-Type: multipart/alternative; boundary="===============7747654958126582044==" MIME-Version: 1.0 Subject: hello From: hello@oursite.com To: user@gmail.com Date: Wed, 11 Apr 2018 17:13:02 -0000 Message-ID: <152346678269.275.17989388690220812241@cf7f5f3375c9> --===============7747654958126582044== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Welcome to our site Elon! Best, The OurSite team --===============7747654958126582044== Content-Type: text/html; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit <strong>Welcome to our site Elon!</strong> Best, The OurSite team --===============7747654958126582044==--
Development
- Deploy:
python setup.py sdist && twine upload dist/*
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django-enhanced-emails-0.0.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a41c871ca9193d7a3a82a92c8de6e2448ded1f4a5bef32fdde2892c3d7273079 |
|
MD5 | 0f4fc70e7bf38d92d6bf9b5ea4bb8813 |
|
BLAKE2b-256 | 45f52489cb0cc8893eb69e5c88ed43d0890ef0e62ee4fc58633b6dedfa922da2 |
Close
Hashes for django_enhanced_emails-0.0.6-py3.6.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c9b579809fa4afc3d4c1bab3e5e3028b803a2919fcd7de4f067eec8a9f95a9c |
|
MD5 | ed057373bb966b1df583f39dc12f459f |
|
BLAKE2b-256 | 1d3361497410ed799df7e364b6c55b8be2be0d0ccf84788c40ef8d45fbf4848a |