[Mimedefang] RE: Filtering on sender, recipient, and subject at the same time

Craig Green cgreen at sentex.net
Fri Jul 8 17:08:18 EDT 2005


McCarthy, Douglas J wrote:

>
>The cool part about having it be in filter_recipient would be that I
>could use the ACCEPT_AND_NO_MORE_FILTERING return code before any of the
>anti-spam and anti-virus stuff got called.  Another part of our setup
>requires that spam sent from these systems arrive unfiltered at another
>company-owned system, and we had been using ACCEPT_AND_NO_MORE_FILTERING
>to allow that.
>
>I will have to figure out a different way to implement that.
>
>  
>

That's fairly easy--I've used blocks resembling the following for 
various purposes:

sub filter_end ($) {

# Setup, header processing, blah, blah

# Spam checks if SpamAssassin is installed and recip. isn't intra-company.
    my $internal_recip = 0;
    foreach my $recip (@Recipients) {
        if ($recip =~ /\@mycompany.com/i) {
            $internal_recip = 1;
            last;
        }
    }

    if ($Features{"SpamAssassin"} && !$internal_recip) {

# Spam Checks

    }

# End stuff, etc.

}


You can do something similar before the message_contains_virus() call in 
filter_begin if you really want--just "return if  ($recip =~ 
/\@mycompany.com/i)".

I highly recommend you avoid this, however; passing spam around isn't 
dangerous, but passing virii around is.

Craig.
------


   
 



More information about the MIMEDefang mailing list