Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
django-mail-templated
Advanced tools
Send emails using Django template system
.. image:: https://readthedocs.org/projects/django-mail-templated/badge/?version=latest :target: http://django-mail-templated.readthedocs.org/en/latest/?badge=latest :alt: Documentation Status
.. image:: https://badge.fury.io/py/django-mail-templated.svg :target: https://badge.fury.io/py/django-mail-templated :alt: PyPI Package
.. image:: https://circleci.com/gh/artemrizhov/django-mail-templated/tree/master.svg?style=shield :target: https://circleci.com/gh/artemrizhov/django-mail-templated/tree/master :alt: CircleCI Status
This is a tiny wrapper around the standard EmailMessage
class and
send_mail()
function that provides an easy way to create email messages
using the Django template system <https://docs.djangoproject.com/es/1.9/topics/templates/>
_.
Just pass template_name
and context
as the first parameters then use as
normal.
Built with OOP, KISS and flexibility in mind. Really small and simple, but yet full-featured (I hope).
Extends and mimics the built-in Django's EmailMessage
and
send_mail()
. Compatible as much as possible.
Fully supports Django template system including template inheritance (thanks to BradWhittington for the note about the problem).
Supports any possible template engines and loaders.
Supports serialisation (thanks to arjandepooter).
Fully covered with tests.
Tested with Django 1.4-1.9.
Compatible with Python 3.
http://django-mail-templated.readthedocs.org
Run:
.. code-block:: console
pip install django-mail-templated
And register the app in your settings file:
.. code-block:: python
INSTALLED_APPS = (
...
'mail_templated'
)
Create template:
.. code-block:: html+django
{% extends "mail_templated/base.tpl" %}
{% block subject %}
Hello {{ user.name }}
{% endblock %}
{% block body %}
{{ user.name }}, this is a plain text message.
{% endblock %}
{% block html %}
{{ user.name }}, this is an <strong>html</strong> message.
{% endblock %}
Send message:
.. code-block:: python
from mail_templated import send_mail
send_mail('email/hello.tpl', {'user': user}, from_email, [user.email])
Advanced usage:
.. code-block:: python
from mail_templated import EmailMessage
message = EmailMessage('email/hello.tpl', {'user': user}, from_email,
to=[user.email])
# TODO: Add more useful commands here.
message.send()
More useful info and examples at http://django-mail-templated.readthedocs.org
FAQs
Send emails using Django template system
We found that django-mail-templated demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.