[Mimedefang] Filtering based on relay and alias file

Al Sparks data345 at yahoo.com
Mon Apr 19 01:14:44 EDT 2004


I have a email server that delivers mail both locally and relay. 
Basically I'm using the 
    /etc/mail/aliases
file for relaying on a per user basis.

All email coming in has the same domain (@mydomain.com) and I want the
email to only get filtered if it's relayed to other machines (e.g.
@imap.mydomain.com).

I tried using the filter_recipient to do this, for example:

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.

Again, all incoming email is addressed to @mydomain.com so the above
filter isn't working.

Suggestions?
  === Al



More information about the MIMEDefang mailing list