Verify Valid Domain
Date : December 22, 2003
Use this code to verify if the domain part of an email address is valid:
use Net::DNS; $email = "[email protected]"; (undef, $domain) = split (/@/, $email); $resolver = new Net::DNS::Resolver(); $response ||= $resolver->query($domain, "MX") || $resolver->query($domain, "A"); defined ($response) ? print "$domain is valid" : print "$domain is invalidn";
It might also be a good idea to skip known domains, such as yahoo.com, google.com, etc.