Compare commits
2 Commits
4d45269ae4
...
280884a058
Author | SHA1 | Date | |
---|---|---|---|
|
280884a058 | ||
|
4a6f66af1a |
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "pubkeys"]
|
||||||
|
path = pubkeys
|
||||||
|
url = https://git.wtf-eg.de/ag-admin/pubkeys.git
|
101
mail2members.sh
Executable file
101
mail2members.sh
Executable file
@ -0,0 +1,101 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
echo "usage"
|
||||||
|
echo "====="
|
||||||
|
echo ""
|
||||||
|
echo "reads a csv-file with member-data and a text-template from template"
|
||||||
|
echo "uses erb to fill the template with data, encrpyt and sign the mail with the members public pgp key and send it via swaks(swiss army knife for smtp)"
|
||||||
|
echo ""
|
||||||
|
echo "./$0"
|
||||||
|
echo "\t-h --help"
|
||||||
|
echo "\t--member-data=member-data.csv"
|
||||||
|
echo "\t--template=template.erb"
|
||||||
|
echo "\t--subject=subject"
|
||||||
|
echo "\t--smtphost=smtphost"
|
||||||
|
echo "\t--smtpuser=smtpuser"
|
||||||
|
echo "\t--smtppassword=smtppassword"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
while [ "$1" != "" ]; do
|
||||||
|
PARAM=`echo $1 | awk -F= '{print $1}'`
|
||||||
|
VALUE=`echo $1 | awk -F= '{print $2}'`
|
||||||
|
case $PARAM in
|
||||||
|
-h | --help)
|
||||||
|
usage
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
-n)
|
||||||
|
DRYRUN=1
|
||||||
|
;;
|
||||||
|
--member-data)
|
||||||
|
MEMBER_DATA=$VALUE
|
||||||
|
;;
|
||||||
|
--template)
|
||||||
|
TEMPLATE=$VALUE
|
||||||
|
;;
|
||||||
|
--subject)
|
||||||
|
SUBJECT=$VALUE
|
||||||
|
;;
|
||||||
|
--smtphost)
|
||||||
|
SMTPHOST=$VALUE
|
||||||
|
;;
|
||||||
|
--smtpuser)
|
||||||
|
SMTPUSER=$VALUE
|
||||||
|
;;
|
||||||
|
--smtppassword)
|
||||||
|
SMTPPASSWORD=$VALUE
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "ERROR: unknown parameter \"$PARAM\""
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$MEMBER_DATA" ] ; then
|
||||||
|
echo "parameter member-data missing"
|
||||||
|
echo ""
|
||||||
|
usage
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$TEMPLATE" ] ; then
|
||||||
|
echo "parameter template missing"
|
||||||
|
echo ""
|
||||||
|
usage
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$SUBJECT" ] ; then
|
||||||
|
echo "parameter userid missing"
|
||||||
|
echo ""
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "MEMBER_DATA = "$MEMBER_DATA
|
||||||
|
echo "TEMPLATE = "$TEMPLATE
|
||||||
|
echo "SUBJECT = "$SUBJECT
|
||||||
|
|
||||||
|
if [ -z "$DRYRUN" ] ; then
|
||||||
|
echo "real run"
|
||||||
|
erb column1=Column1 column2=Column2 column3=Column3 $TEMPLATE\
|
||||||
|
| gpg2 --batch --yes -vvv -u vorstand@wtf-eg.de \
|
||||||
|
--no-emit-version -eas -r "42152130EE5C8BED881AB911D65BA8BC7E8B9302" \
|
||||||
|
| swaks --to frank.landgraf@web.de \
|
||||||
|
--from "vorstand@wtf-eg.de" \
|
||||||
|
-tls \
|
||||||
|
--auth LOGIN \
|
||||||
|
--server $SMTPHOST \
|
||||||
|
--auth-user $SMTPUSER \
|
||||||
|
--auth-password $SMTPPASSWORD \
|
||||||
|
--header "Subject: $SUBJECT" --body -
|
||||||
|
else
|
||||||
|
echo "dry run"
|
||||||
|
erb column1=Column1 column2=Column2 column3=Column3 $TEMPLATE
|
||||||
|
erb column1=Column1 column2=Column2 column3=Column3 $TEMPLATE|gpg2 --batch --yes -vvv -u vorstand@wtf-eg.de --no-emit-version -eas -r "42152130EE5C8BED881AB911D65BA8BC7E8B9302"
|
||||||
|
fi
|
1
pubkeys
Submodule
1
pubkeys
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 251b0b1309abc1ddada54f657bf4e817da71a164
|
3
test/test-member-data.csv
Normal file
3
test/test-member-data.csv
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Line,Nick,Email,PGP,Passwort
|
||||||
|
110,gulliver,frank.landgraf@web.de,4215 2130 EE5C 8BED 881A B911 D65B A8BC 7E8B 9302,this is not my real password
|
||||||
|
|
|
7
test/test.erb
Normal file
7
test/test.erb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Sehr geehrtes Mitglied <%= column1 %>,
|
||||||
|
|
||||||
|
Loginname: <%= column2 %>
|
||||||
|
Passwort:<%= column3 %>
|
||||||
|
|
||||||
|
Mit freundlichen Grüßen,
|
||||||
|
Bossman
|
Reference in New Issue
Block a user