From 95fd80564b10bf02b31b918fd06da2bcb773c58b Mon Sep 17 00:00:00 2001 From: Pirate Praveen <praveen@onenetbeyond.org> Date: Fri, 25 Sep 2020 23:51:45 +0200 Subject: [PATCH] Script used to send mails from a csv file and template --- Scripts/sendmail.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Scripts/sendmail.sh diff --git a/Scripts/sendmail.sh b/Scripts/sendmail.sh new file mode 100644 index 0000000..7b5e6c8 --- /dev/null +++ b/Scripts/sendmail.sh @@ -0,0 +1,24 @@ +while IFS=, read -r name email +do + echo "Sending mail to $name <$email>.." + cp email.template.txt email.body.txt + sed -i "s/TEMPLATE:ADDRESS/$email/" email.body.txt + sed -i "s/TEMPLATE:NAME/$name/" email.body.txt + /usr/sbin/sendmail -t < email.body.txt + rm email.body.txt + sleep 60 +done < email-list.csv +# Sample email.template.txt +# From: "Your Name" <email@example.com> +# To: TEMPLATE:ADDRESS +# Subject: Your email subject +# Content-Type: text/plain; charset=utf-8 +# Content-Transfer-Encoding: 8bit +# +# Dear TEMPLATE:NAME, + +# Your email body +# Signature + +# Sample email-list.csv +# Firstname Surname,email@example.com -- GitLab