X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=learn_from_spam;h=63cb9f8789b1fa4f32934bb2942ce6d97c490a76;hb=f14d68e0b26433ab1000f229bf942f7e7be64264;hp=071f7f1f49576eef9fff9cb1c00ca1dbe5aafc84;hpb=9340655d004d11ad7e15bfae940e608c87d0cf05;p=bin.git diff --git a/learn_from_spam b/learn_from_spam index 071f7f1..63cb9f8 100755 --- a/learn_from_spam +++ b/learn_from_spam @@ -6,8 +6,8 @@ HAM_REPORT="spamassassin --revoke" SPAM_CHECK="spamassassin -e" # these are for spamc -SPAM_REPORT="spamc --learntype=spam" -HAM_REPORT="spamc --learntype=ham" +SPAM_REPORT="spamc --learntype=spam -s $((100 * 1024 * 1024))" +HAM_REPORT="spamc --learntype=ham -s $((100 * 1024 * 1024))" SPAM_CHECK="spamc -s $((100 * 1024 * 1024)) -c" # needs rules directories @@ -18,7 +18,9 @@ if [ "$(basename $0)" = "learn_from_spam" ]; then for file in "$@"; do if ! formail -c < "$file"|grep -q '^List-Id'; then $SPAM_REPORT < "$file" >/dev/null 2>&1; - fi; + else + spamasssin --local --report < "$file" >/dev/null 2>&1; + fi formail -c < "$file" | grep -e '^From ' -e 'From: ' | spamassassin --add-to-blacklist >/dev/null 2>&1; formail -c < "$file" | grep -e '^From ' -e 'From: ' | spamassassin --remove-from-whitelist >/dev/null 2>&1; # check to see if it's still ham @@ -27,7 +29,7 @@ if [ "$(basename $0)" = "learn_from_spam" ]; then TMP="$(mktemp -d)" trap "rm -f '$TMP'/file; rmdir '$TMP'" EXIT # this message is still not spam; may need custom rules - spamc < "$file" > "$TMP/file" 2>/dev/null; + spamc -s $((100 * 1024 * 1024)) < "$file" > "$TMP/file" 2>/dev/null; mv "$TMP/file" "${NEEDS_SPAM_RULES}/cur/$(basename "$file")"; trap - EXIT; rmdir "$TMP"; @@ -43,7 +45,7 @@ elif [ "$(basename $0)" = "learn_from_ham" ]; then mkdir -p "${NEEDS_HAM_RULES}/cur"; TMP="$(mktemp -d)" trap "rm -f '$TMP'/file; rmdir '$TMP'" EXIT - spamc < "$file" > "$TMP/file" 2>/dev/null; + spamc -s $((100 * 1024 * 1024)) < "$file" > "$TMP/file" 2>/dev/null; mv "$TMP/file" "${NEEDS_HAM_RULES}/cur/$(basename "$file")"; trap - EXIT; rmdir "$TMP";