first working version for gv sending login data

This commit is contained in:
Gulliver 2021-04-27 01:38:02 +02:00
parent 280884a058
commit d89017241e

View File

@ -81,21 +81,47 @@ 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
# we read the columns from $MEMBER_DATA file into these variables
# variables are used in script and also overhanded to erb
while IFS="," read -r lineno nick email fingerprint passwort
do
echo "Displaying Record-$lineno"
echo "Nick: $nick"
echo "email: $email"
echo "fingerprint: $fingerprint"
# echo "passwort: $passwort"
echo "-------"
if [ -z "$DRYRUN" ] ; then
# we take over nick and passwort into the erb template
# TODO this is not a generic solution !!!
# the file $TEMPLATE contains the erb template
#
# gpg uses the trust-model always
#
# swaks uses the other variables for sending per SMTP
# to mailhost
erb nick="$nick" passwort="$passwort" $TEMPLATE \
| gpg2 -vvv --trust-model always\
-u vorstand@wtf-eg.de \
--no-emit-version \
-eas -r ${fingerprint// /} \
| swaks --to "$email" \
--from "vorstand@wtf-eg.de" \
-tls \
--auth LOGIN \
--server $SMTPHOST \
--auth-user $SMTPUSER \
--auth-password $SMTPPASSWORD \
--header "Subject: $SUBJECT" --body -
else
erb nick="$nick" passwort="$passwort" $TEMPLATE
erb nick="$nick" passwort="$passwort" $TEMPLATE \
| gpg2 -vvv --trust-model always\
-u vorstand@wtf-eg.de \
--no-emit-version \
-eas -r ${fingerprint// /}
fi
done < $MEMBER_DATA