I find that Mail::Audit and Mail::SpamAssassin work well together. Here is my filter code (for a kmail client):
#!/usr/bin/perl # # A cutsom filter to process my email use Mail::Audit; open LOG, ">>/home/kvale/.audit_log"; print LOG localtime() . ": "; my $item = Mail::Audit->new( nomime => 1 ); my $subject = $item->subject(); if ($item->subject =~ /\[SPAM\s+\?\]/i) { print LOG "phy spam: $subject\n"; $item->print_out(); } use Mail::SpamAssassin; my $mail = Mail::SpamAssassin->new(); my $status = $mail->check( $item ); if ($status->is_spam()) { $item->replace_header( subject => '***SPAM***' . $subject); my @report = split /\n/, $status->get_report(); shift @report until $report[0] =~ /^Content analysis/; print LOG "SA Spam: $subject\n", join "\n", @report, "\n"; $item->print_out(); } print LOG "OK: $subject\n"; $item->print_out();
Note that M::SA methods work nicely with M::A objects.

It is not true that new tests cannot be written into SpamAssassin. Look in the rules directory for info, write some yourself, and put them in your .cf file. If your rules need more than the builtin methods can offer, it is pretty simple add your own module with the custom code. If you don't want to do that much hacking, SA 3.0.0 will have a plugin framework for these sorts of expansion needs.

-Mark


In reply to Re: Using Mail::Audit and Mail::SpamAssassin together by kvale
in thread Using Mail::Audit and Mail::SpamAssassin together by Corion

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.