[Mimedefang] Filtering based on relay and alias file

David F. Skoll dfs at roaringpenguin.com
Mon Apr 19 08:20:30 EDT 2004


On Sun, 18 Apr 2004, Al Sparks wrote:

> sub filter_recipient {
>     my ($recipient, $sender, $ip, $hostname, $first, $helo,
> 	$rcpt_mailer, $rcpt_host, $rcpt_addr) = @_;
>
>     if (($recipient =~ /mail1.mydomain.com>?$/i) or
> 	($recipient =~ /dogbox.mydomain.com>?$/i) ) {
> 	md_syslog('info', "locallocal");
> 	return ('ACCEPT_AND_NO_MORE_FILTERING', "ok");
>     }
>     md_syslog('info', "remote recip $recipient");
>     return ('CONTINUE', "ok");
> }

> So if email received is headed to mail1 or dogbox (mail1 is the local
> machine, actually) it's not supposed to be filtered, and if it's
> relayed to any other machine, such as imap then it is supposed to be
> filtered.

It doesn't work.  Milter is passed the address exactly as it appears in
the SMTP dialog, before any aliasing.  You may be able to examine $rcpt_host
to find out where the mail is destined, or you might have to force
MIMEDefang to simulate Sendmail's aliasing process (easiest way is to invoke
sendmail -bv, but it's slow and potentially unreliable, depending on the
permissions of your alias files.)

--
David.



More information about the MIMEDefang mailing list