Skip to content

Instantly share code, notes, and snippets.

@kgaughan
Created December 1, 2008 17:43
Show Gist options
  • Save kgaughan/30779 to your computer and use it in GitHub Desktop.
Save kgaughan/30779 to your computer and use it in GitHub Desktop.
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