複製程式
function get_host($sEmailToSend)
{
$sGatewayIP = ཹ.31.233.1'
//$sGatewayIP = 餀.95.1.1'
preg_match("'\.*@(.*)'sim",$sEmailToSend,$aMatches);
$sNSLookup = shell_exec("nslookup -q=mx {$aMatches[1]} {$sGatewayIP} ");
preg_match_all("'^.*MX preference = (\d{1,10}), mail exchanger = (.*)$'simU",$sNSLookup,$aMXMatches);
if(!emptyempty($aMXMatches[2])){
return true;
}else{
$hosts = gethostbynamel($aMatches[1]);
if (is_array($hosts)) {
return true;
}else{
return false;
}
}
}