[Mimedefang] Rejecting some recipients

Jeff Grossman jeff at stikman.com
Thu Sep 15 22:30:31 EDT 2005


> -----Original Message-----
> From: mimedefang-bounces at lists.roaringpenguin.com [mailto:mimedefang-
> bounces at lists.roaringpenguin.com] On Behalf Of Matthew.van.Eerde at hbinc.com
> Sent: Thursday, September 15, 2005 3:20 PM
> To: mimedefang at lists.roaringpenguin.com
> Subject: RE: [Mimedefang] Rejecting some recipients
> 
> Jeff Grossman wrote:
> > Sorry for the run on message before.  I have MIMEDefang set up with
> > the md_check_against_smtp_server setting.
> 
> Is it possible the SMTP server check is what's causing the timeout?
> 
> If it's only fifteen, I'd just hardcode this into your mimedefang-filter
(untested:)
> 
[snipped code]

Actually, I am already doing something similar.  Here is the code I am
using.  I removed some of the e-mail addresses so it wasn't so long.  But, I
am still getting the time outs.  I figured using the access database method,
I would be sure to not have any e-mails get through.

sub filter_recipient {

my($recip, $sender, $ip, $host, $first, $helo, $rcpt_mailer, $rcpt_host,
        $rcpt_addr) = @_;

$recip2 = $recip;
$recip2 =~ tr/<>//d;
$recip2 = lc($recip2);

$sender2 = $sender;
$sender2 =~ tr/<>//d;
$sender2 = lc($sender2);

$senderdomain = $sender;
$senderdomain =~ /.+\@(.+)>?/;  # extract domain part (minus angle bracket)

if (($recip2 eq 'email1 at turners.com' or
        $recip2 eq 'email2 at turners.com' or
        $recip2 eq 'email3 at turners.com' or
        $recip2 eq 'email1 at myturners.com') and
        ($sender2 ne 'email3 at aol.com' and
        $sender2 ne 'email1 at msn.com')) {
                action_notify_administrator("Recipient: $recip2\nSender:
$sender2\nIP: $ip");
                return ('REJECT', 'The intended recipient is not allowed to
receive e-mail');
}

if ($recip2 eq 'email1 at mail.turners.com' or
        $recip2 eq 'email2 at mail.turners.com') {
                return ('ACCEPT_AND_NO_MORE_FILTERING', "ok");
}

if ($recip2 eq 'email9 at turners.com' and $senderdomain =~
/^newdaydeals.com$/i) {
        action_notify_administrator("Bryan received an e-mail from
$sender");
        return ('REJECT', 'You are not allowed to send e-mail to this
recipient');
}

$recip =~ /.+\@(.+)>?/;  # extract domain part (minus angle bracket)
my $domain = $1;
$domain =~ s#[<>]##g;

if (($domain =~ /^turners.com$/i) ||
        ($domain =~ /^turnersoutdoorsman.com$/i) ||
        ($domain =~ /^turnersoutdoorsman.net$/i) ||
        ($domain =~ /^turnersoutdoorsman.org$/i) ||
        ($domain =~ /^egunsandammo.com$/i) ||
        ($domain =~ /^myturners.com$/i) ||
        ($domain =~ /^turners.us$/i) ||
        ($domain =~ /^sgdistributing.us$/i) &&
        ($domain !~ /^lists.turners.com$/i) &&
        ($domain !~ /^mail.turners.com$/i)) {
                return md_check_against_smtp_server($sender, $recip,
                        "mail.turners.com", "192.168.168.15");
}

if ($domain =~ /^lists.turners.com$/i) {
        return md_check_against_smtp_server($sender, $recip,
                "mail.turners.com", "192.168.168.228", "2525");
}

return('CONTINUE', "OK");
}




More information about the MIMEDefang mailing list