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 "TEMPLATE = "$TEMPLATE
echo "SUBJECT = "$SUBJECT echo "SUBJECT = "$SUBJECT
if [ -z "$DRYRUN" ] ; then # we read the columns from $MEMBER_DATA file into these variables
echo "real run" # variables are used in script and also overhanded to erb
erb column1=Column1 column2=Column2 column3=Column3 $TEMPLATE\ while IFS="," read -r lineno nick email fingerprint passwort
| gpg2 --batch --yes -vvv -u vorstand@wtf-eg.de \ do
--no-emit-version -eas -r "42152130EE5C8BED881AB911D65BA8BC7E8B9302" \ echo "Displaying Record-$lineno"
| swaks --to frank.landgraf@web.de \ echo "Nick: $nick"
--from "vorstand@wtf-eg.de" \ echo "email: $email"
-tls \ echo "fingerprint: $fingerprint"
--auth LOGIN \ # echo "passwort: $passwort"
--server $SMTPHOST \ echo "-------"
--auth-user $SMTPUSER \
--auth-password $SMTPPASSWORD \ if [ -z "$DRYRUN" ] ; then
--header "Subject: $SUBJECT" --body - # we take over nick and passwort into the erb template
else # TODO this is not a generic solution !!!
echo "dry run" # the file $TEMPLATE contains the erb template
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" # gpg uses the trust-model always
fi #
# 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