Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/almet/mass-emailer.py

Send emails from templates and datasets.
https://github.com/almet/mass-emailer.py

Last synced: 15 days ago
JSON representation

Send emails from templates and datasets.

Awesome Lists containing this project

README

        

Mass emailer
############

Python script to send email templates from a list of emails, a template and
replacement data for the templates.

This works as follows:

Create the templates
====================

Create the templates using the Jinja2 syntax. For instance::

Hi {name}, you are receiving this email because you are {reason}.

Thanks for all of what you are doing,
Cheers,
The team.

Create this file and let's say you name it ``body``. Create a second template
named ``subject`` with the subject of the email.

Create the list of emails + info
================================

Every format supported by `tablib `_
will work correctly.

For instance, let's say we have a json file with the following values, named
``dataset.json``::

'[
{"reason": "the one", "email": "[email protected]", "name": "Mr Toto"},
{"reason": "right here, right now", "email": "[email protected]", "name": "Alexis"}
]'

Run the script !
================

Once you've done that, just run the script::

mass-email -t template-folder -d dataset.json

Or use it as a library
======================

You might prefer to use this software as a library, in this case, it would
look like this::

import mass_emailer

mass_emailer.send_emails(templates_folder="mail-template.tpl", dataset="dataset.json")