Simple customizable email template built for Django
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)
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
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/600x150',
'footer_links': [],
'footer_copyright': '',
'footer_content': "Here is your content",
'colors': {
'background': "#EEEEEE",
'container_border': "#DDDDDD",
'container_background': "#FFFFFF",
'container': "#505050",
'title': "#444444",
'footer': "#888888",
'footer_link': "#2C9AB7",
'button': "#2C9AB7",
}
}
}
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 :
Here are all the settings you can define:
SIMPLE_MAIL = {
'CONTEXT': {
'header_url': 'http://placehold.it/600x150',
'footer_links': [],
'footer_copyright': '',
'footer_content': "Here is your content",
'colors': {
'background': "#EEEEEE",
'container_border': "#DDDDDD",
'container_background': "#FFFFFF",
'container': "#505050",
'title': "#444444",
'footer': "#888888",
'footer_link': "#2C9AB7",
'button': "#2C9AB7",
}
},
'TEMPLATE': 'simple_mail/default.html',
'EMAILS': [],
'BASE_URL': '',
'FROM_EMAIL': ''
}
Defines the values that needs to be populated to all your emails.
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.
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'],
]
}
Defines the base url to resolve links.
Defines the mail to send from by default.
If you are having issues, please let us know or submit a pull request.
The project is licensed under the MIT License.