[Mimedefang] get tests including scores from SA

John Rudd john at rudd.cc
Mon Nov 27 17:51:48 EST 2006


Sven Schuster wrote:
> Hi David,
> 
> On Mon, Nov 27, 2006 at 04:56:55PM -0500, David F. Skoll told us:
>> Sure.  It's not written in stone that you have to use
>> spam_assassin_check().  If you'd rather, you can call spam_assassin_status(),
>> which returns the Mail::SpamAssassin::PerMsgStatus object.  You can then
>> manipulate that as desired.
> 
> thanks for this really fast answer!
> Of course you are right, I just thought something like that some
> seconds after hitting "y" in mutt to send the mail ;-)
> Little bit too late here in .de for doing something productive...
> 
> 

I actually use the report that spam_assassin_check() returns, and sift 
out the lines that refer to tests.  I end up with something like this:

X-SpamCheck: Yes, score=5.969 required=5 tests=BAYES_99, HTML_90_100, 
HTML_MESSAGE, MIME_HTML_ONLY, MSGID_FROM_MTA_HEADER, MSGID_FROM_MTA_ID, 
NO_REAL_NAME
X-SpamScore: sssss
X-SpamReport: 0.0 MSGID_FROM_MTA_HEADER  Message-Id was added by a relay
X-SpamReport: [score: 1.0000]
X-SpamReport: 3.5 BAYES_99               BODY: Bayesian spam probability 
is 99 to 100%
X-SpamReport: 0.0 MIME_HTML_ONLY         BODY: Message only has 
text/html MIME parts
X-SpamReport: 0.0 HTML_MESSAGE           BODY: HTML included in message
X-RUDD-CC-SpamReport: 0.1 HTML_90_100            BODY: Message is 90% to 
100% HTML
X-SpamReport: 1.4 MSGID_FROM_MTA_ID      Message-Id for external message 
added locally
X-SpamReport: 1.0 NO_REAL_NAME           From: does not include a real name



(currently, the X-SpamReport headers are in reverse order, which is why 
the bayes "[score:" line is above the BAYES_99 line instead of after it; 
I have a new version of the code for this in testing, but not yet in 
production)

I'll post the subroutine I use for this after I make that leap.  It 
literally just takes a header name variable and the $report result, from 
spam_assassin_check(), as arguments.

generate_report_headers("X-SpamReport", $report);

It's not the same as having the scores in the test SpamCheck header, but 
  I like it this way better, as I also get to see the test explanations.






More information about the MIMEDefang mailing list