Mail-SPF-Iterator

 view release on metacpan or  search on metacpan

samples/spflookup.pl  view on Meta::CPAN

    'h|help' => sub { usage() },
    'spfdfl=s' => \$spfdfl,
    'passall=s' => \$pass_all,
    'dns=s'  => sub {
	my ($ip,$port) = $_[1] =~m{^([^:]+)(?::(\d+))?\z} or die $_[1];
	$resolver = Net::DNS::Resolver->new( nameservers => [$ip]);
	$resolver->port($port) if $port;
    }
) or usage();

my ($ip,$sender,$helo,$local) = @ARGV;
($ip && $sender) or usage();

#### SPF lookup
my $spf = Mail::SPF::Iterator->new($ip, $sender, $helo || '', $local, {
    default_spf => $spfdfl,
    pass_all => $pass_all,
});
my $result = $spf->lookup_blocking(undef,$resolver);
print "Received-SPF: ".$spf->mailheader."\n";
print "Explanation: ".($spf->result)[3]."\n" if $result eq SPF_Fail;

samples/unbound.pl  view on Meta::CPAN

my ($resolver,$spfdfl,$pass_all);
GetOptions(
    'd|debug' => sub { Mail::SPF::Iterator->import( Debug => 1 ) },
    'h|help' => sub { usage() },
    'spfdfl=s' => \$spfdfl,
    'passall=s' => \$pass_all,
) or usage();

my $dns = DNS::Unbound->new();

my ($ip, $sender, $helo, $local) = @ARGV;
($ip && $sender) or usage();

my $spf = Mail::SPF::Iterator->new(
    $ip, $sender, $helo || q<>, $local,
    {
        default_spf => $spfdfl,
        pass_all => $pass_all,
    },
);

samples/unbound_async.pl  view on Meta::CPAN

my ($resolver,$spfdfl,$pass_all);
GetOptions(
    'd|debug' => sub { Mail::SPF::Iterator->import( Debug => 1 ) },
    'h|help' => sub { usage() },
    'spfdfl=s' => \$spfdfl,
    'passall=s' => \$pass_all,
) or usage();

my $dns = DNS::Unbound::Mojo->new();

my ($ip, $sender, $helo, $local) = @ARGV;
($ip && $sender) or usage();

my $spf = Mail::SPF::Iterator->new(
    $ip, $sender, $helo || q<>, $local,
    {
        default_spf => $spfdfl,
        pass_all => $pass_all,
    },
);

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.286 second using v1.00-cache-2.02-grep-82fe00e-cpan-c9a218a2bbc )