diff options
author | Erich Eckner <git@eckner.net> | 2016-04-18 20:30:58 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2016-04-18 21:13:24 +0200 |
commit | 7eebdef03cc9eee7aec5ded3fe1e45eb1234d2a1 (patch) | |
tree | 6532250bc2651f67e6846505ea5ae323e7395925 | |
parent | 387a73c08c7250a719b28b1e48c8757bed609784 (diff) | |
download | sendmailadvanced-7eebdef03cc9eee7aec5ded3fe1e45eb1234d2a1.tar.xz |
kann jetzt mehrere Adressatenv1.0.3
-rwxr-xr-x | sendmailadvanced | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/sendmailadvanced b/sendmailadvanced index 3cd015d..12a327c 100755 --- a/sendmailadvanced +++ b/sendmailadvanced @@ -23,7 +23,7 @@ else fi -eval set -- "$(getopt -o eh:i:st --long encrypt,hook:,inline:,no-hooks,stamp -n "$(basename "$0")" -- "$@" || echo verwendung)" +eval set -- "$(getopt -o eh:i:st --long encrypt,hook:,inline:,no-hooks,stamp -n "$(basename "$0")" -- "$@")" while true do @@ -33,6 +33,7 @@ do hooks[${#hooks[@]}]="$1" ;; -i|--inline) + echo "inline erkannt" shift datei="$1" ;; @@ -83,32 +84,42 @@ fi ) | \ ( IFS='' - while read -r s + adressatenString="" + adressatenSammeln=false + while read -r zeile do - echo "${s}" + echo "${zeile}" | grep -q "\S" || break + s="${zeile}" if [ "${s:0:3}" == "To:" ] || [ "${s:0:3}" == "Cc:" ] then - s="${s:4}" - if [[ "${s}" == *"<"*">"* ]] - then - s="${s#*<}" - s="${s%>*}" - fi - tos[${#tos[@]}]="${s}" - elif [ "${s:0:8}" == "Subject:" ] - then - break - fi - done - ${stamp} && hashcash -b ${hashcash_bits} -Xm "${tos[@]}" - while read s - do - echo "${s}" - if [ "${s}" == "" ] - then - break + adressatenSammeln=true + s=" ,${s:4}" fi + [ "${s:0:1}" == " " ] || adressatenSammeln=false + ${adressatenSammeln} && adressatenString="${adressatenString}${s}" + echo "${zeile}" done + + if ${stamp} + then + IFS=',' + for adressat in ${adressatenString} + do + if [[ "${adressat}" == *"<"*">"* ]] + then + adressat="${adressat#*<}" + adressat="${adressat%>*}" + fi + adressat="$( + echo "${adressat}" | \ + tr -d "[:space:]" + )" + echo "${adressat}" | grep -q "\S" || continue + hashcash -b ${hashcash_bits} -Xm "${adressat}" + done + fi + echo "${zeile}" + ( ${applyHooks} && body_header_hook "${hooks[@]}" cat |