[Mimedefang] MIMEDefang 2.28-BETA-2 is available

Systems Administrator sysadmin at aims.gov.au
Tue Dec 10 21:10:01 EST 2002


> Hey David can you supply an example of code using this to block a
couple of
> ranges for outbound mail?  Some of us aren't real Perl savvy but
getting
> this feature to work would ROCK!  Does this need to go in a
filter_sender
> sub?  I don't think we have one in our current filter.

Thought I'd take a shot at this one... 

This example will let all mail relayed from 127.0.0.1 (localhost) and
any 192.168.1.* address (change to suit the range you want) bypass any
further filters, any other relays will still be subject to any other
filters you have in place. The code is untested so take the necessary
precautions, also I'm assuming the return still expects 2 elements, I'm
sure I'll be corrected if this is not the case or there's a problem with
my syntax or thinking.

sub filter_relay {
        my($relayaddress, $name, $helo) = @_;
        if ($relayaddress eq "127.0.0.1" and
             $address =~ /^192\.168\.1\./) {
		    # Localhost or within the 192.168.1.* range, so
bypass further filtering
                return("ACCEPT_AND_NO_MORE_FILTERING", "bypass");
        } else {
	  # Not one of ours, keep filtering
        return ("CONTINUE", "filter");
	  }
}

Regards
Nick

><> ><> ><> ><> ><> ~~~~~ <>< <>< <>< <>< <><
Systems Administrator
Australian Insitute of Marine Science
Townsville, FNQ, Australia
Phone +61 7 4753 4400  Fax +61 7 4772 5852
Email: sysadmin at aims.gov.au
><> ><> ><> ><> ><> ~~~~~ <>< <>< <>< <>< <><





More information about the MIMEDefang mailing list