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
Close
Hashes for django-enhanced-emails-0.0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e2b28a877625d8da7067f5c711f1aa6559a8944ee0381d7d79f2f5c9fc6bf10 |
|
MD5 | d81eabf46aa7b275346b44384983041d |
|
BLAKE2b-256 | b1df5a5d09d60110665092cc06a45598c2e461e2bb7018b36f6d1ca767c3eb19 |