From: Don Armstrong Date: Fri, 14 Feb 2014 21:57:20 +0000 (-0800) Subject: use formail -c to handle from and to addresses X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=b65995929085ebf2bd0fc8c1371995b150564d9b;p=bin.git use formail -c to handle from and to addresses redo report for spam messages before sticking into the needs rules directory --- diff --git a/learn_from_spam b/learn_from_spam index 88545f8..4cacf66 100755 --- a/learn_from_spam +++ b/learn_from_spam @@ -13,17 +13,17 @@ SPAM_CHECK="spamc -c" if [ "$(basename $0)" = "learn_from_spam" ]; then for file in "$@"; do $SPAM_REPORT < "$file" >/dev/null; - grep -e '^From ' -e 'From: ' "$file" | spamassassin -R >/dev/null; + formail -c < "$file" | grep -e '^From ' -e 'From: ' | spamassassin -R >/dev/null; # check to see if it's still spam - if ! spamc -c < "$file"; then + if ! spamc -c < "$file" >/dev/null; then # this message is still not spam; may need custom rules - cp "$file" ~/Maildir/spam/needs_rules/cur/; + spamc "$file" > ~/Maildir/spam/needs_rules/cur/"$(basename "$file")"; fi; done; elif [ "$(basename $0)" = "learn_from_ham" ]; then for file in "$@"; do $HAM_REPORT < "$file" >/dev/null; - grep -e '^From ' -e 'From: ' -e 'To: ' -e 'Cc: ' "$file"|spamassassin -W>/dev/null; + formail -c < "$file" |grep -e '^From ' -e 'From: ' -e 'To: ' -e 'Cc: '|spamassassin -W>/dev/null; done; else "Called in a way this script cannot recognize";