Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/pythonindia/pyconindia

PyCon India
https://github.com/pythonindia/pyconindia

Last synced: 7 days ago
JSON representation

PyCon India

Awesome Lists containing this project

README

        

Publicity Mail Usage
====================

The command line syntax of the tool is as given below.
The ``-c``, ``-s`` and ``-t`` options are mandatory::

usage: publicitymail [-h] [-c CONFIG] [-s SUBJECT] [-t TEMPLATE]

optional arguments:
-h, --help show this help message and exit
-c CONFIG, --config CONFIG
Configuration file
-s SUBJECT, --subject SUBJECT
Mail subject
-t TEMPLATE, --template TEMPLATE
Mail body template

An example configuration file is available at ``conf/example1.cfg``.
An example template file is available at ``conf/example1.template``.

Any value inside the configuration can be overridden using a specially
formatted environment variable. The environment variable name should
be in this format: PUBLICITY__

For example, to override the value of ``password`` inside the ``main`` section,
set an environment variable named ``PUBLICITY_MAIN_PASSWORD`` like this::

export PUBLICITY_MAIN_PASSWORD=the-real-password

Once the configuration file and template is ready, a mail can be send like
this::

publicitymail -c /path/to/config.cfg -s "The mail subject" -t /path/to/some.template

It is recommended to use separate configuration and template for different mails.

The configuration
-----------------

This is example configuration::

[main]
username = [email protected]
password = this-is-wrong-password
from_email = [email protected]
from_name = Baiju Muthukadan

[to_addresses]
[email protected] = Bangalore
...

[[email protected]]
key1 = value1
...

The ``main`` section has the ``username`` and ``password`` for the Gmail account.
It also contains the email and name from whom the mail is sending.

The ``to_addresses`` section lists all the recipients email address and name.
There should be separate sections for each address to include user specific
values in the mail. The values given in the email sections can be used in
template file using the Jinja2 macro syntax. In the above example,
the ``value`` corresponding to ``key1`` can be used in the mail like this:
``{{ key1 }}``.

To comment any line, add ``#`` character at the beginning of that
line. More specifically, the ``#`` should be the first character in
that line.

The template file use the Jinja2 template language.