Created
May 22, 2018 17:24
-
-
Save tateisu/7158814ca15700808364e3b83f35d47a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl -- | |
## $ perl check-email-mx.pl <email.txt | |
use strict; | |
use warnings; | |
use Net::DNS; | |
my %mx; | |
for(;;){ | |
my $email = <>; | |
last if not $email; | |
$email =~ s/[\x0d\x0a]+//; | |
next if not $email =~ /(.+?)\@(.+)/; | |
my($user,$domain)=($1,$2); | |
my $mx_list = $mx{$domain}; | |
if(not $mx_list){ | |
my @names = map{ $_->exchange } mx($domain); | |
$mx_list = $mx{$domain} = \@names; | |
} | |
for my $mx (@$mx_list){ | |
if( $mx =~ /\Q.mailasrvs.pw\E/ ){ | |
print "$email: $mx\n"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment