This makes it easy to loop through a CSV file and send template emails to many people. We use it to quickly send the same public records request to more than 40 school boards in New Orleans.
Usage
Usage: easyemail [options]
Options:
-h, --help Show this help message and exit.
-l, --live Send emails to their actual recipients.
-d, --dry-run Test output by sending one email to test email address (default: [email protected]).
Setup
git clone https://github.com/TheLens/easy-email.git
cd easy-email
chmod +x easyemail
Make sure easyemail
is in your PATH
. If currently in same directory:
export PATH=$(pwd):$PATH
You will need to temporarily turn off two-step verification, if you have it set up. You might also need to [allow your Gmail account to be accessed by insecure apps](Insecure Gmail). Make sure you change these back after you are finished.
Steps
- Download CSV from Google Sheets and name
recipients.csv
. Make sure to use columns "name" and "email." - Update the request template with any new language. Make sure CSV headers match the variables in the template.
- Update email subject, from and CC variables in
easyemail
. - Update environment variables
EASYEMAIL_GMAIL_USERNAME
andEASYEMAIL_GMAIL_PASSWORD
for the account that will be sending the emails. - Run
easyemail --dry-run
to test that everything looks okay. - If everything looks good, run
easyemail --live
to send the emails for real.
Known limitations
- Currently only supports a single recipient per email.
- Only uses Gmail.