[Mimedefang] Spamassassin & MimeDefang

Rich West Rich.West at divatv.com
Thu Mar 28 17:07:58 EST 2002

I have been using MimeDefang at a few installations (Solaris and Linux) 
with great success.  The installation includes Anomy::Html and 

My question is on the integration of SpamAssassin.. I've tried to set 
whitelist_from *@ebay.com in the /etc/mail/spamassassin.cf file, but 
that seems to be getting ignored.

I currently use a "my_spam_assassin_check" routine over the default 
because, at one time, I needed to see the reports that were getting 
generated.  And, since then, I have kept it around as an option.

Still, though, more than half of the ebay mailings (for bidding or 
listing) get tagged as SPAM.  This is fine for home use since it is easy 
to dig through an pull the ebay mail out of the spam folder, but users 
have started groaning about it at the other locations I have it 
installed (like they should be doing eBay stuff at work anyhow, but 

I thought about modifying the filter to allow all email from "ebay.com" 
to come through, but then I thought better of it, since it is really 
spamassassin's job.. it should recognize the setting in spamassassin.cf 
and use that, unless I am missing something here..

Would going back to useing the built in spamassassin check solve this? 
 Or is there a particular way in which I must tell mimedefang to use the 
whitelist from spamassassin's config file?


Important parts of the filter follow:
sub my_spam_assassin_check() {
    use Mail::SpamAssassin::MyMailAudit;

    open(IN, "<./INPUTMSG") or return 0;

    my $mail = Mail::SpamAssassin::MyMailAudit->new(data=>\*IN);
    my $spamtest =
            local_tests_only   => 1,  # razor and DNS checks.
            dont_copy_prefs    => 1,
            userprefs_filename => "/etc/mail/spamassassin.cf"});

    my $status = $spamtest->check($mail);

    my $hits = $status->get_hits;
    my $req = $status->get_required_hits();
    my $names = $status->get_names_of_tests_hit();
    my $report = $status->get_report();
    return ($hits, $req, $names, $report);

sub filter_begin
   my $hits;
   my $req;
   my $names;
   my $report;

      if ((-s "./INPUTMSG") <= 102400) # The cutoff limit is a 100K message
         ($hits,$req,$names, $report) = my_spam_assassin_check();
         if ($hits >= $req)
            action_add_header("X-Spam-Warning", "This message is SPAM");
         action_add_header("X-Spam-Score", "hits=$hits required=$req");
         $SA_REPORT = $report;
         action_add_header("X-Spam-Warning", "Messages over 100K are not 
         $SA_REPORT = "";

sub filter_end
   my ($entity) = @_;
   if ($DEBUG)
      append_boilerplate($entity, "\n$SA_REPORT\n");

Richard West				mailto:richard.west at divatv.com
Sr. Systems Administrator
Diva - Princeton, NJ			http://www.divatv.com

More information about the MIMEDefang mailing list