Commit 3f74755b authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

We should add X-Spam-Flag if Spamassassin detected spam; we should check messages up to 1MB

parent 3af6d80c
...@@ -265,32 +265,22 @@ sub filter_end { ...@@ -265,32 +265,22 @@ sub filter_end {
# Spam checks if SpamAssassin is installed # Spam checks if SpamAssassin is installed
if ($Features{"SpamAssassin"}) { if ($Features{"SpamAssassin"}) {
if (-s "./INPUTMSG" < 100*1024) { if (-s "./INPUTMSG" < 1024*1024) {
# Only scan messages smaller than 100kB. Larger messages # Only scan messages smaller than 1MB. Larger messages
# are extremely unlikely to be spam, and SpamAssassin is # are extremely unlikely to be spam, and SpamAssassin is
# dreadfully slow on very large messages. # dreadfully slow on very large messages.
my($hits, $req, $names, $report) = spam_assassin_check(); my($hits, $req, $names, $report) = spam_assassin_check();
my($score);
if ($hits < 40) {
$score = "*" x int($hits);
} else {
$score = "*" x 40;
}
# We add a header which looks like this: # We add a header which looks like this:
# X-Spam-Score: 6.8 (******) NAME_OF_TEST,NAME_OF_TEST # X-Spam-Flag: Yes
# The number of asterisks in parens is the integer part # X-Spam-Score: 6.8 NAME_OF_TEST,NAME_OF_TEST
# of the spam score clamped to a maximum of 40.
# MUA filters can easily be written to trigger on a
# minimum number of asterisks...
if ($hits >= $req) { if ($hits >= $req) {
action_change_header("X-Spam-Score", "$hits ($score) $names"); action_change_header("X-Spam-Flag", "Yes");
action_change_header("X-Spam-Score", "$hits $names");
md_graphdefang_log('spam', $hits, $RelayAddr); md_graphdefang_log('spam', $hits, $RelayAddr);
# If you find the SA report useful, add it, I guess...
action_add_part($entity, "text/plain", "-suggest",
"$report\n",
"SpamAssassinReport.txt", "inline");
} else { } else {
# Delete any existing X-Spam-Flag header?
action_delete_header("X-Spam-Flag");
# Delete any existing X-Spam-Score header? # Delete any existing X-Spam-Score header?
action_delete_header("X-Spam-Score"); action_delete_header("X-Spam-Score");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment