If greylisting is installed on the mx host then he send a "451 4.7.1 Please try again later"
My code fragment:
<?php
//...
foreach ($mx_records as $mx_host) {
$code = CheckMX($mx_host, $eMail);
if ($code == 0) continue; // host not found
if ($code == 451) $code = CheckMX($mx_host, $eMail); // Greylisting
if ($code == 250) {
$ok = true;
break;
}
}
//...
function CheckMX($mx_host, $eMail)
{
$code = 0;
$fp = @fsockopen($mx_host, 25, $errno, $errstr, 2);
if ($fp) {
send_command($fp, 'HELO microsoft.com');
send_command($fp, 'MAIL FROM:<[email protected]>');
$erg = send_command($fp, 'RCPT TO:<'.$eMail.'>');
fclose($fp);
$code = intval(substr($erg, 0, 3));
}
return $code;
}
//...
?>