On Jan 21, 2004, at 15:36, Mike Batchelor wrote:


SA 2.6x run by itself out of .procmailrc or spamc/spamd seems to add an autolearn=X flag to tell you what happened to the message as it interacted with the autolearn system. But I run SA+MD on a relay, and I don't get these flags when calling spam_assassin_check() from mimedefang-filter's filter_end() function. Here's my code snippet:

my ($hits, $req, $names, $report) = spam_assassin_check();
if ($hits >= 10) {
return action_bounce("SPAM: hits=$hits, req=10.0, tests=$names");
}
if ($hits >= $req) {
action_add_header("X-Spam-Status","Yes, hits=$hits, req=$req, tests=$names");
} else {
action_add_header("X-Spam-Status","No, hits=$hits, req=$req, tests=$names");
}
if ($hits >= 1 ) {
my spamgraph = '*' x ($hits > 50 ? 50 : $hits);
action_add_header("X-Spam-Level","$spamgraph ($hits)");
}


I'm using MIMEDefang 2.38. Is there any way to get access to the autolearn= flags to stuff in there somewhere? Do I need an upgrade to MIMEDefang to get a newer spam_assassin_check() that returns this information?

We've run in to the same sort of issues, trying to make SA+MD look like original SA.


Try the following bit of code in your filter_end before you write the headers.

                if (!defined($SASpamTester->{auto_learn_status})) {
                    $learn = "no";
                } elsif ($SASpamTester->{auto_learn_status}) {
                    $learn = "spam";
                } else {
                    $learn = "ham";
                }

And then add that after your $tests you can put in "autolearn=$learn"

Also, you may want to change your action_add_header to action_change_header which will overwrite any existing SA headers rather than cause duplicates.

I've also got code to put in the appropriate X-Spam-Checker-Version, X-Spam-Status, X-Spam-Flag, etc. as well as subject rewriting including custom tags from SQL and SA style MIME encapsulation of original spam message.

Ian

--
Ian White
South Island Community Access Network (SICAN)
email: [EMAIL PROTECTED]



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

Reply via email to