commit:     c3e62801d978b906e1879ebcb9e43d99c00c77e6
Author:     Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto <AT> gentoo 
<DOT> org>
AuthorDate: Sun Aug 27 16:34:34 2017 +0000
Commit:     Jorge Manuel B. S. Vicetto <jmbsvicetto <AT> gentoo <DOT> org>
CommitDate: Sun Aug 27 16:35:08 2017 +0000
URL:        https://gitweb.gentoo.org/proj/elections.git/commit/?id=c3e62801

Add scripts for sending the confirmation emails for elections.

Signed-off-by: Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto <AT> 
gentoo.org>

 mail-scripts/email       |  6 ++++++
 mail-scripts/mail-table  |  1 +
 mail-scripts/mail-voters | 17 +++++++++++++++++
 3 files changed, 24 insertions(+)

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-name> election,
+
+<signature>

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 @@
+<nick> <email>

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=<election-name>
+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="$u...@gentoo.org"
+       fi
+       ( echo "To: $to";
+       echo "From: electi...@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}

Reply via email to