Convenient helper to send multipart/alternative or regular email based on templates.
Project description
This small module is inspired by my need for sending templated emails, with the
option of attaching an HTML formatted alternative.
Installation
=============
Installing::
pip install django-email-templates
Example usage
==============
The following example demonstrates how to send a templated email, in this case
the user has submitted a contact form. The module will look for the templates
contact.txt and contact.html which will serve as the plaintext and html alternative
of the email. The default location of the templates is a directory named *email_templates*.::
from email_templates import send_templated_mail
context = {
'name': request.POST['name'],
'email': request.POST['email'],
'telephone': request.POST['phone'],
'message': request.POST['message'],
}
success = send_templated_mail(
'Contact form submission',
None,
[a[1] for a in settings.ADMINS],
'contact',
context
)
option of attaching an HTML formatted alternative.
Installation
=============
Installing::
pip install django-email-templates
Example usage
==============
The following example demonstrates how to send a templated email, in this case
the user has submitted a contact form. The module will look for the templates
contact.txt and contact.html which will serve as the plaintext and html alternative
of the email. The default location of the templates is a directory named *email_templates*.::
from email_templates import send_templated_mail
context = {
'name': request.POST['name'],
'email': request.POST['email'],
'telephone': request.POST['phone'],
'message': request.POST['message'],
}
success = send_templated_mail(
'Contact form submission',
None,
[a[1] for a in settings.ADMINS],
'contact',
context
)
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
Close
Hashes for django-email-templates-0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d9128c33f87bfb2a3afb95c50f06df1e48fd7512827b12fb6f1b28de01bb271 |
|
MD5 | 12c82ceb4580cac5675c8a7883f87e09 |
|
BLAKE2b-256 | b8a864e02af34e2ba6425b2c5bf13b2d92d7bfe3f4d3855fdee419b070aec4cf |
Close
Hashes for django_email_templates-0.1-py2.6.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c5e7ba9c72b0b2d9d831a97993b4c810a67bf6ba85a6bd907c92309c2280e41 |
|
MD5 | de43c766527a6b2e5aabfd446eb900c8 |
|
BLAKE2b-256 | 136afa697d66f7894eeb709505cc73d4b28d048ba96df1f333e706941f9fa2a0 |