delta / mailer

Command line mail utility
MIT License
1 stars 5 forks source link

mailer


Command line mail utility

Build Status

Installation:

  1. Clone the repo on your computer and cd to the root folder of the project.
  2. run python setup.py install

Usage:

NOTE: The following examples call the program delta-mail. This is how it is currently named, however the name is expected to be changed soon.

The folder ./mail-campaigns/festember/c1 should have the following structure:

- template.mmtmpl
- mailinglist.ml
- subject.txt
- globals.mvar

The first two files are required. The last file is optional. If the subject.txt file is missing, then the subject will be taken as the directory name (here, c1).

(For the first type of command, the subject can NOT be a template.)

Format of a .ml file:

First line contains the list of fields (tab separated) - the variables that are referred to in the mmtpl file. The first field is invariably the email field. The following fields can be anything.

If files are to be attached, have a field called $attachments, and the corresponding entry in each row can be an empty string or a semicolon-separated list of paths. Each path must lead to a valid file.

The next line is left blank

From the third line, each row will contain the values of the appropriate fields, and this data will be used to make personalised emails

Example:

email   fname   lname   dob $attachments

bob@rob.com Bob Rob 26-8-2015   ~/delta/mailer/README1.md;~/delta/mailer/main.py
hog@rob.com Hog Rob 26-8-1996   ~/delta/mailer/README2.md;~/delta/mailer/main.py

This file, when used as the -R option, will generate two mails.

NOTE: As of now, this does not allow you to send CC and BCC. Also, it doesn't not allow you to send the same email to multiple receipients - if you want to do that, you'll have to have two separate rows in the above file (i.e., comma-separated list of emails is not supported. No error will be raised as of now. It will silently fail)

Format of a .mvar file:

Each line is of form: {VARIABLE}={VALUE}

Empty lines are ignored

Spaces to the right of the equal-to sign are considered part of the value. Trailing spaces in variable names are ignored. Spaces aren't allowed in the variable names themselves. Though they may contain any other characters (other than = of course)

$attachments is a special variable - its value should be a semicolon separated list of paths that lead to valid files. These files will be attached to the mail.

Testing:

As of now, the code is semi-automatically tested. The test suite does the job of sending the mails and creating preview files, and in case there is any problem in that then some tests will fail. However, if the mails are being sent correctly, but not being received as desired, or if there is no error in the preview file creation, but the files aren't being created properly (say, badly formatted or something like that), then in that case, the test suite cannot do anything. Hence, THAT part of the testing is manual.

Please refer to individual test files for further details regarding their behavior.