A Django oriented templated / transaction email abstraction
Project description
==========
Django-Templated-Email
==========
:Info: A Django oriented templated email sending class
:Author: Bradley Whittington (http://github.com/bradwhittington, http://twitter.com/darb)
Overview
=================
django-templated-email is oriented towards sending templated emails
intended for use with transactional mailers (ala mailchimp, silverpop,
etc.), but currently comes out of the box with a backend class which
uses django's templating system, and django's core.mail functions.
The send_templated_email method can be thought of as the render_to_response
shortcut for email.
Getting going - installation
=============
Installing::
pip install templated_email
You can add the following to your settings.py (but it works out the box)::
TEMPLATED_EMAIL_BACKEND = 'templated_email.backends.vanilla_django.TemplateBackend'
# For the django back-end specifically
TEMPLATED_EMAIL_DJANGO_SUBJECTS = {
'welcome':'Welcome to my website',
}
Getting going - sending your template emails
=============
Example usage using vanilla_django TemplateBackend backend
Python to send mail::
from templated_email import send_templated_email
send_templated_email(
template_name='welcome',
from_email='from@example.com',
recipient_list=['to@example.com'],
context={
'username':request.user.username,
'full_name':request.user.get_full_name(),
'signup_date':request.user.date_joined
}
)
Which looks in django template directories/loaders for
*templated_email/welcome.txt* ::
Hey {{full_name}},
You just signed up for my website, using:
username: {{username}}
join date: {{signup_date}}
Thanks, you rock!
It will also use *templated_email/welcome.html* for the html part
of the email allowing you to make it so much pretty. It is plausible
that one day there will be support for attachments and inline mime / images
.. _Django: http://djangoproject.com
Django-Templated-Email
==========
:Info: A Django oriented templated email sending class
:Author: Bradley Whittington (http://github.com/bradwhittington, http://twitter.com/darb)
Overview
=================
django-templated-email is oriented towards sending templated emails
intended for use with transactional mailers (ala mailchimp, silverpop,
etc.), but currently comes out of the box with a backend class which
uses django's templating system, and django's core.mail functions.
The send_templated_email method can be thought of as the render_to_response
shortcut for email.
Getting going - installation
=============
Installing::
pip install templated_email
You can add the following to your settings.py (but it works out the box)::
TEMPLATED_EMAIL_BACKEND = 'templated_email.backends.vanilla_django.TemplateBackend'
# For the django back-end specifically
TEMPLATED_EMAIL_DJANGO_SUBJECTS = {
'welcome':'Welcome to my website',
}
Getting going - sending your template emails
=============
Example usage using vanilla_django TemplateBackend backend
Python to send mail::
from templated_email import send_templated_email
send_templated_email(
template_name='welcome',
from_email='from@example.com',
recipient_list=['to@example.com'],
context={
'username':request.user.username,
'full_name':request.user.get_full_name(),
'signup_date':request.user.date_joined
}
)
Which looks in django template directories/loaders for
*templated_email/welcome.txt* ::
Hey {{full_name}},
You just signed up for my website, using:
username: {{username}}
join date: {{signup_date}}
Thanks, you rock!
It will also use *templated_email/welcome.html* for the html part
of the email allowing you to make it so much pretty. It is plausible
that one day there will be support for attachments and inline mime / images
.. _Django: http://djangoproject.com
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
File details
Details for the file django-templated-email-0.1.1.tar.gz
.
File metadata
- Download URL: django-templated-email-0.1.1.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02f0720c8b6e06143637cfa15901d1f627afc0752fdc6ef23521995e7779b813 |
|
MD5 | a0f0d86774fd839433ffe594d84c0456 |
|
BLAKE2b-256 | 1c19465af7d43d733828780fe9c974a9984aa469e2a63d8f5edb9a4f33efb8e3 |