Created
December 1, 2008 17:43
-
-
Save kgaughan/30779 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
function can_host_receive_mail($host) { | |
if (checkdnsrr($host, 'MX')) { | |
return true; | |
} | |
// We try the host itself if it exists no MX records were found, as per | |
// RFC2821. | |
if (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA')) { | |
$h = @fsockopen($host, 25, $errno, $errstr, 30); | |
if ($h) { | |
fclose($h); | |
return true; | |
} | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment