[Mimedefang] Perl help: quarantine and bounce criteria

alan premselaar alien at 12inch.com
Mon Jan 24 17:51:45 EST 2005


Kenneth Porter wrote:
> 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);
>        }
> }
> 
Kenneth,

   I think something similar has recently come up on the list.  what's 
the actual value of $Recipients[0]?  if it's '<info at domain.tld>' (no 
quotes) then it won't match, and it'll call 
action_quarantine_entire_message.  (because you're testing for with !~)

hope this helps

alan



More information about the MIMEDefang mailing list