Generates and sends emails based on a CSV template. Useful for Gmail and for sending customized attachments to each recipient.
DEPENDENCIES:
- Jinja2: http://jinja.pocoo.org/docs/ (easy_install Jinja2)
- Python 2.7.1 or greater (only tested on 2.7.1)
How to use:
- Create a CSV "workfile" containing all of your email details. Each row should contain header info (FROM, TO, CC, BCC, and SUBJECT). FROM is required, as is at least one of TO, CC, and BCC. SUBJECT is optional.
- BODY should be a path (absolute or relative to the location of the CSV workfile) to a template file that uses Jinja2 templating syntax (see http://jinja.pocoo.org/docs/templates/ for details). Each row can have a different value for BODY if you want.
- SUBJECT should just be a string in the CSV, though it can also use Jinja2 template syntax. (BODY can also be a string.)
- Fields beginning with ATTACHMENT should be paths (again, absolute or relative to the location of the CSV workfile) to attachment files.
- You also need to create a file containing the details of the account to which you want to connect. This file needs to have 3 lines, with the SMTP host and port on the first, the user account on the second, and the account password on the third.
- Run sendtmail to use. Use the -d [--debug] flag to run in debug mode and print out all of the emails without sending them.
The following templates are provided as examples:
- Email account file: "[email protected]"
- Email template: "sample_email_template"
- Workfile: "sample_workfile.csv"