[Mimedefang] md_check_against_smtp_server

joris dedieu joris.dedieu at gmail.com
Fri Jan 2 06:29:05 EST 2015


2014-12-30 23:53 GMT+01:00 Jon Rowlan <jon.rowlan at sads.com>:
> I'd like to thank everyone who replied to my recent query regarding
> md_check_against_smtp_server.
>
> The end result is now working beautfifully and inspired by the replies I
> am looking into caching the lookup results.

I use a Redis database for that. It's quite efficient.

Joris

sub filter_recipient()
{
        my($recipient, $sender, $ip, $host, $first, $helo,
$rcpt_mailer, $rcpt_host, $rcpt_addr) = @_;
        $recipient =~ s/[<>]//g;
        if($RelayAddr =~ /^127|^192|^172/) {
                return ("CONTINUE", "OK");
        }
       #XXX: redis connection fail not handled
        my $redis = Redis->new();
        my $key = $redis->get("$recipient");
        if($key eq "OK") {
                $redis->quit;
                return ("CONTINUE", "OK");
        }
        elsif($key eq "WRONG") {
                $redis->quit;
                return ("REJECT", "User unknown");
        }
        else {
                my ($status, $message) =
md_check_against_smtp_server($sender, $recipient, "blaba",
"XXXXX",25);
                if($status eq "CONTINUE") {
                        $redis->set("$recipient","OK");
                        $redis->expire("$recipient", 432000);
                }
                if($status eq "REJECT") {
                        $redis->set("$recipient","WRONG");
                        $redis->expire("$recipient", 432000);
                }
                if($status eq "TEMPFAIL") {
                        $status = "CONTINUE";
                        $message = "OK";
                }
                $redis->quit;
                return ($status, $message);

        }
}


>
> I'd like to wish everyone here seasons felicitations.
>
> All the best for 2015 !
>
> Regards
>
> jON
>
> _______________________________________________
> NOTE: If there is a disclaimer or other legal boilerplate in the above
> message, it is NULL AND VOID.  You may ignore it.
>
> Visit http://www.mimedefang.org and http://www.roaringpenguin.com
> MIMEDefang mailing list MIMEDefang at lists.roaringpenguin.com
> http://lists.roaringpenguin.com/mailman/listinfo/mimedefang



More information about the MIMEDefang mailing list