From b65995929085ebf2bd0fc8c1371995b150564d9b Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Fri, 14 Feb 2014 13:57:20 -0800 Subject: [PATCH] use formail -c to handle from and to addresses redo report for spam messages before sticking into the needs rules directory --- learn_from_spam | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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"; -- 2.39.5