From c3e62801d978b906e1879ebcb9e43d99c00c77e6 Mon Sep 17 00:00:00 2001 From: "Jorge Manuel B. S. Vicetto (jmbsvicetto)" Date: Sun, 27 Aug 2017 16:34:34 +0000 Subject: Add scripts for sending the confirmation emails for elections. Signed-off-by: Jorge Manuel B. S. Vicetto (jmbsvicetto) --- mail-scripts/email | 6 ++++++ mail-scripts/mail-table | 1 + mail-scripts/mail-voters | 17 +++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 mail-scripts/email create mode 100644 mail-scripts/mail-table create mode 100644 mail-scripts/mail-voters diff --git a/mail-scripts/email b/mail-scripts/email new file mode 100644 index 0000000..df5701f --- /dev/null +++ b/mail-scripts/email @@ -0,0 +1,6 @@ +Hello. + +INSERT +For the election officials for the election, + + diff --git a/mail-scripts/mail-table b/mail-scripts/mail-table new file mode 100644 index 0000000..24d72bf --- /dev/null +++ b/mail-scripts/mail-table @@ -0,0 +1 @@ + diff --git a/mail-scripts/mail-voters b/mail-scripts/mail-voters new file mode 100644 index 0000000..c38f895 --- /dev/null +++ b/mail-scripts/mail-voters @@ -0,0 +1,17 @@ +election= +while read num user; +do grep -q "confirmation $num" master-${election} || continue; + email=$(grep "$user" mail-table); + if [[ ! -z $email ]]; then + to="${email#$user }" + else + to="$user@gentoo.org" + fi + ( echo "To: $to"; + echo "From: elections@gentoo.org" + echo "Date: $(date -R)"; + echo "Subject: Your ${election} confirmation id"; + echo ""; + sed -e "s/^INSERT.*/Your confirmation number is $num./" email -e "s/ELECTION/$election/"; ) \ + | /usr/lib/sendmail -oi $to; +done < confs-${election} -- cgit v1.2.3-65-gdbad