[Mimedefang] Testing aliased address
Alan Madill
amadill at hwy16.com
Fri Nov 21 13:08:11 EST 2003
Where would be the best place to pick out the to address of aliased mail? We get a fair
bit of postmaster notify mail that gets aliased to root on machine A. It gets aliased again
to a real user and sent on to machine B where I'm testing MD and SA. When it ends up in
the real users mailbox the To: address is still postmaster at machineA . I'm testing in filter
recipient for that address but by then it is aliased and the HELO info is to realuser.
This is the snippet from mimedefang-filter.
# Test to see if we do any filtering at all
# called after filter_relay and filter_sender
sub filter_recipient {
my ($recipient, $sender, $ip, $hostname, $first, $helo,
$rcpt_mailer, $rcpt_host, $rcpt_addr) = @_;
if ($recipient =~ /^<?postmaster\@.*\.hwy16\.com>?$/i) {
# this is fine because all of these these go to me and I have another system doing
# virus scans. No point in wasting resources.
md_syslog('warning', "Postmaster mail accepted and forwarded") if ($MDXdebug);
return ('ACCEPT_AND_NO_MORE_FILTERING', "ok");
}
$recipient =~ s/[<>]//g;
$recipient =~ s/\@.*//;
$recipient = lc($recipient);
# get user prefs from MySQL database
my($prefs) = MDXgetuserprefs($recipient, "MDXdofilter");
md_syslog('warning', "Test of MDXgetuserprefs for $recipient, "
." MDXdofilter is $prefs->{MDXdofilter}->{value}") if ($MDXdebug);
# The rest of this assumes that the user prefs are available
# If the MySQL server goes down then just exit
return ('CONTINUE', "ok") if not $prefs;
if ( $prefs->{MDXdofilter}->{value} ) {
return ('CONTINUE', "ok");
} else {
return ('ACCEPT_AND_NO_MORE_FILTERING', "ok");
}
md_syslog('err', "We should not get here in filter_recipient!");
return ('CONTINUE', "ok");
}--
Alan Madill - Aspen House Systems
250 567-4200
More information about the MIMEDefang
mailing list