Perl script used to email a message to multiple people
./bin/generic-emailer --config example.ini --input example.tsv --template template.txt --live
You should install the Perl dependencies listed in cpanfile like so.
cpanm --installdeps .
Specifying --live
will make the script send out emails. Not specifying this will cause the program to warn email output to screen. Do this before you spam people with a lot of email.
Input should be space separated values such as the following (tab separated and with column headers):
name email number
Andy [email protected] 2.5
Bob [email protected] 1.25
Kylie [email protected] 9
Chardonnay [email protected] 1.3
Each line is a person to send the email to, their email address and anything that should be subs. More examples are available from example.tsv
.
The template should be a Template::Tiny file. Attributes are available from the [template_defaults]
section of the config file and each row of the input TSV file is made available with the same column headers.
The subject line is specified in the config file. Subject can also be a Template::Tiny string and will have the same parameters given to it as the main template.
See example.ini
for more details
The emailer uses Email::Sender to forward the generated messages onto an SMTP server. You configure these settings in the [smtp]
block of the config INI file. If you do not require SMTP authentication then the configuration is as easy as:
[smtp]
host=smtp.example.com
port=25
Consult the Email::Sender::Transport::SMTP for more configuration information.