This does what you want
function verifyemail_validatehost($email, $return_mxhost=0) {
if (!verifyemail_validateemail($email)) {
return false;
exit;
}
list($local,$domain) = explode("@",$email,2);
$mxhosts = array();
if(!checkdnsrr($domain, "MX") || !getmxrr($domain, $mxhosts)) {
return false;
exit;
}
if ($return_mxhost) {
return $mxhosts;
exit;
}
return true;
}