Bash script to run a basic mailing list
- Bash shell (can be adapted to other shells)
mailx
- Clone the repo:
$ git clone [email protected]:lukebarone/email_list.git
-
Edit the main shell script, and change the variables at the top to point to your three files, and specify a subject / From email address. For more details, refer to the Files section.
-
Run the script:
$ email_list.sh
- A preview appears. If you like the preview, press Enter to continue. If you don't press Ctrl+C to cancel the script and fix your message.
The script relies on 3 files to be created, and the path/filenames specified in the main shell script.
This file will be where you enter email addresses, one per line. The script will cycle through this file, and send one email per line (prevents any sort of address-leak)
This file accepts HTML. This is the main "body" of your message. This is the file you will likely be editing the most.
This file accepts HTML. This is the footer that is added to the end of your email. For example, instructions on how to unsubscribe, or links to your website.
This is the main executable file. Please edit it to fill in the SUBJECT
,
FROM_EMAIL
variables, as well as the LIST_FILE
, BODY_FILE
and FOOTER_FILE
variables to the path/file name of the files. You can then send emails by running
the script:
$ ./email_list.sh