Re: [Exim] Routing with Spamcop

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Paul Makepeace
Date:  
À: exim list
Sujet: Re: [Exim] Routing with Spamcop
On Wed, Jul 31, 2002 at 10:14:14AM +0100, Matthew Byng-Maddick wrote:
>
> If you've got embedded perl, you could try something like:
>
> ${perl {check_rbls} {$sender_host_address}}
>
> with
>
> --------8<--------
> my @blacklists=qw(
>     bl.spamcop.net
>     relays.osirusoft.com
> );

>
> sub check_rbls {
>     my $ip_addr = shift;

>
>     $ip_addr=reverse split /\./ , $ip_addr;

>
>     for my $bl (@blacklists) {
>         if( defined ( gethostbyname ($ip_addr . "." . $bl) ) ) {
>             return "yes";
>         }
>     }
>     return "no";
> }
> -------->8--------


(Perl nit-pick, just in case someone wants to use this cool trick: the
array to scalar conversion above will squish all four IP parts into a
big number.)

sub check_rbls {
    my $rev_ip = join ".", reverse split /\./, shift;


    foreach my $bl (@blacklists) {
        return "yes" if defined gethostbyname "$rev_ip.$bl";
    }


    return "no";
}


Paul

--
Paul Makepeace ....................................... http://paulm.com/

"What is foo? Ask again."
-- http://paulm.com/toys/surrealism/