A command line utility to send one-off emails to a large set of users through Mailgun written in node.js (v8+).
In the project folder do
npm install
Make a copy the sample config file:
cp config.sample.json config.json
Update config.json
and enter the Mailgun domain and api key.
To send a campaign you will need a set of files that describe the campaign:
subject.txt: One liner for email subject
body.html: HTML version of the email
body.txt: Text version of the email
users.csv: A list of users to send to
See the examples/
folder for sample data.
Type npm start -- --sendit
to start an interactive input of your data files or npm start -- -h
for a list of command line arguments.
The utility will batch send the email using the Mailgun batch API.
Note that unless the --sendit
command line argument is specified no email
will be actually sent (fake mode by default).
TODO
Mailgun supports test mode in order to consume the send API request but not
actually send it. To enable test mode set mailgun.testmode
to true
in the
config.json
.
Note that Mailgun charges for test mode
Mailgun supports tagging for categorizing email traffic. To add tags to the emails sent, populate the mailgun.tags
array in the config.json
.
To specify a reply-to address set the mailgun.reply-to
property in config.json
.
The easiest way to configure the utility is to provide a config.json
, however you can also create a configuration file that is loaded based on the NODE_ENV
enviroment variable. The utility will try to load a
config.<NODE_ENV>.json
before falling back to config.json
.
For example:
NODE_ENV=production npm start
will load
config.production.json
To run the test suite do:
npm test
TODO