[Mimedefang] Perl help: quarantine and bounce criteria

Kenneth Porter shiva at sewingwitch.com
Mon Jan 24 16:33:31 EST 2005


I've got the following function for bouncing spam/viri in my office server. 
This gets invoked whenever the filter would bounce or discard, such as when 
the spam score is over 10.

If the mail was addressed to a legitimate local mailbox (other than info or 
hostmaster) I want to quarantine instead of drop, but I'm still getting 
quarantines for a single local recipient of info or hostmaster, so I've got 
a bug in that expression I need help with.

sub action_discard_bounce ($) {
        my($message) = @_;
        # don't quarantine if all recipients are @sewingwitch.com
        my $non_sewingwitch =  grep !/\@sewingwitch.com/i, @Recipients;
        # check for only recipient being
        # hostmaster or info (almost certain spam so don't quarantine)
        if ( $non_sewingwitch &&
             ( (scalar @Recipients != 1) ||
               ($Recipients[0] !~
 /^(info|hostmaster)\@microprecisionautomation.com/) )) {
                action_quarantine_entire_message(
"action_discard_bounce $message");
        }
        if (MTA_is_domain_MX($MyDomain,$RelayAddr)) {
                # don't pester mx backup
                return action_discard();
        } else {
                return action_bounce($message);
        }
}




More information about the MIMEDefang mailing list