README
node-simple-newsletter
A simple command line tool to send newsletters using an SMTP server
Install globally, setup .env
, recipients.csv
, and template.pug
in the working directory. See configuration below.
Configuration
$ cp sample.env .env
$ cat .env
SMTP_HOST=mail.example.com
SMTP_PORT=587
SMTP_USE_TLS=FALSE
SMTP_USER=test@example.com
SMTP_PASSWORD=password
FROM=Random User <test@example.com>
LIST_ID=<http://newsletter.example.com>
UNSUBSCRIBE=mailto:test@example.com?subject=unsubscribe-newsletter
$ $EDITOR .env # change the parameters that works with your SMTP server
$ cat recipients.csv
name,email
Goodie Reader,reader@example.com
Yankie Bot,bot@example.com
$ cat template.pug
p Hello #{name}
p This is a newsletter
p Bye bye
Usage
$ npm install -g node-simple-newsletter
$ node-simple-newsletter COMMAND
running command...
$ node-simple-newsletter (-v|--version|version)
node-simple-newsletter/0.0.6 linux-x64 node-v16.0.0
$ node-simple-newsletter --help [COMMAND]
USAGE
$ node-simple-newsletter COMMAND
...
Commands
node-simple-newsletter help [COMMAND]
node-simple-newsletter send
node-simple-newsletter view [TEMPLATE]
node-simple-newsletter help [COMMAND]
display help for node-simple-newsletter
USAGE
$ node-simple-newsletter help [COMMAND]
ARGUMENTS
COMMAND command to show help for
OPTIONS
--all see all commands in CLI
See code: @oclif/plugin-help
node-simple-newsletter send
Send the newsletter
USAGE
$ node-simple-newsletter send
OPTIONS
-h, --help show CLI help
-r, --recipients=recipients [default: recipients.csv] Recipients CSV
-s, --subject=subject [default: Untitled Newsletter Edition] Subject
-t, --template=template [default: template.pug] Template
--toEmail=toEmail [default: email] The field in the csv that represents the recipient email address (used
in calculating the "To" field, and address)
--toName=toName [default: name] The field in the csv that represents the recipient name (used in
calculating the "To" field)
EXAMPLE
$ node-simple-newsletter send -s "How is it going?"
Sending 22 mails
See code: src/commands/send.ts
node-simple-newsletter view [TEMPLATE]
View compiled template
USAGE
$ node-simple-newsletter view [TEMPLATE]
ARGUMENTS
TEMPLATE [default: template.pug] Path to template to preview
OPTIONS
-h, --help show CLI help
EXAMPLE
$ node-simple-newsletter view template.pug
Opening browser
See code: src/commands/view.ts