A simple and customizable email template built for Django
Project description
django-simple-mail
Simple customizable email template built for Django
Requirements
These Django app works with :
Python (>=2.7) (Need to be tested for 3.x)
Django (>=1.9) (Need to be tested for previous versions)
Installation
Install using pip :
pip install django_simple_mail
Add simple_mail to your INSTALLED_APPS setting.
INSTALLED_APPS = (
...
'simple_mail',
)
Then run :
python manage.py makemigrations python manage.py migrate
Preview and customization:
The default mail template is a fork of Mailchimp email-blueprints and looks like this with placeholder values:
You can customize the template with CONTEXT settings :
DEFAULTS = { 'CONTEXT': { 'header_url': 'http://placehold.it/1200x300', 'footer_content': "", 'colors': { 'background': "#222222", 'container_bg': "#FFFFFF", 'title': "#2C9AB7", 'content': "#444444", 'footer': "#888888", 'footer_bg': "#555555", 'button': "#FFFFFF", 'button_bg': "#2C9AB7", } }, 'TEMPLATE': 'simple_mail/default.html', 'EMAIL_TO': '', 'EMAILS': [], 'BASE_URL': '', 'FROM_EMAIL': '' }
Django Admin
You can manage your emails and their content directly from django admin :
You can also use variables inside the fields to make your content more dynamic :
Settings
Here are all the settings you can define:
SIMPLE_MAIL = { 'CONTEXT': { 'header_url': 'http://placehold.it/1200x300', 'footer_content': "", 'colors': { 'background': "#222222", 'container_bg': "#FFFFFF", 'title': "#2C9AB7", 'content': "#444444", 'footer': "#888888", 'footer_bg': "#555555", 'button': "#FFFFFF", 'button_bg': "#2C9AB7", } }, 'TEMPLATE': 'simple_mail/default.html', 'EMAIL_TO': '', 'EMAILS': [], 'BASE_URL': '', 'FROM_EMAIL': '' }
CONTEXT
Defines the values that needs to be populated to all your emails.
TEMPLATE
Defines the path to the template that is used by default. You can use this setting in case your want to modify the default template.
EMAILS
Defines the list of different emails that are used inside your project, for example :
DEFAULTS = { 'EMAILS': [ ['RESETPWD', 'Reset password'], ['WELCOME', 'Welcome a user'], ['VALIDATE', 'Validate a user email'], ] }
BASE_URL
Defines the base url to resolve links.
FROM_EMAIL
Defines the mail to send from by default.
Support
If you are having issues, please let us know or submit a pull request.
License
The project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
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
Hashes for django_simple_mail-1.2.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f244bf90b673ca29c4a6dc60f821d3ec397e09a70e2439248ec45a92cfc6168c |
|
MD5 | c60086b7b94612523de546be225970cc |
|
BLAKE2b-256 | 1b5c18edd287d820df25f92d5d7a577ee0ab74d3c49104da3ccc8544c1193887 |