sub emailValid { my $email=shift; # This is the addr to test my $t=$email; # We're gonna chop up $t mercilessly local *PIPE; my $nslookup; # A very simple stupid way to find nslookup. It's gotta be here # somewhere.... if ( -x "/usr/sbin/nslookup" ) { $nslookup = "/usr/sbin/nslookup"; } else { $nslookup = "/usr/bin/nslookup"; } # # Tokenize the mail address into user@domain syntax $t=~m:^(.*)\@(.*)$:; my($user,$domain)=($1,$2); return 1 if (! $user ) or ( $user eq '' ); # No user! return 2 if (! $domain ) or ( $domain eq '' ); # No domain! my $IFS=$/; # Save that please... $/=''; # We're gonna make one big input... open(PIPE,"$nslookup -type=any $domain 2>&1 |") or carp "Cannot run $nslookup ! " . $! ; my @check=; #slurp! close PIPE; # gulp! $/=$IFS; # put that back. return 3 if grep /Non-existent/,@check; return 0; # Checks out ok... }