diff options
Diffstat (limited to 'check-mail-addr.pl')
-rwxr-xr-x | check-mail-addr.pl | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/check-mail-addr.pl b/check-mail-addr.pl deleted file mode 100755 index 4aa1d0b..0000000 --- a/check-mail-addr.pl +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/perl -use warnings; -use strict; -use IO::Socket::INET; -use File::Basename; -use Net::Domain qw(hostfqdn hostdomain); -use Net::DNS; -use Data::Dumper; - -if(@ARGV < 1) { - print "usage: ", basename($0), " <emailaddress> [<from>]\n"; - exit; -} - -autoflush STDOUT 1; - -sub post { - my $socket = shift; - my $command = shift; - my $ret; - - print " >> $command"; - print $socket $command; - while ($ret = $socket->getline) { - print "<< ".$ret; - $ret =~ /[0-9]([- ]).*/; - last if ($1 eq " "); - } - -} - -my $email = $ARGV[0]; -my $from = $ARGV[1] ? $ARGV[1] : ""; -$email =~ m/.*@(.*)/; -my $domain = $1; - -print "Getting MX for $domain\n"; -my @mx = mx($domain); - -print "Connecting to ".$mx[0]->exchange."\n"; -my $socket = IO::Socket::INET->new( - PeerAddr => $mx[0]->exchange, - PeerPort => 25, - Proto => "tcp") || die "Error: couldn't create socket."; - -print "<< ".$socket->getline; -post $socket,"EHLO ".hostfqdn()."\r\n"; -post $socket, "MAIL FROM:<$from>\r\n"; -post $socket, "RCPT TO:<$email>\r\n"; -post $socket, "QUIT\r\n"; - |