email_valid function not working??
| From: | Ben Rigby | Date: | Wed, 09 May 2001 19:50:39 +0000 |
| Subject: | email_valid function not working?? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-52171@lists.php.net to get a copy of this message | ||
hi. thanks in advance for any help!
i'm trying to make the email_valid function that i found on php.net
work.
i can get it to validate the email formatting, but it always fails on
the MX check and the DNS check.
any ideas??? thanks! please cc ben@akimbodesign.com with any answers
function valid_email ($email) {
if
(eregi("^[0-9a-z_]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$",
$email,$check)) {
echo "passed formatting test. ";
if ( getmxrr(substr(strstr($check[0], '@'), 1), $validate_email_temp)
) {
echo "passed getmxrr test. ";
return TRUE;
}
// THIS WILL CATCH DNSs THAT ARE NOT MX.
if(checkdnsrr(substr(strstr($check[0], '@'), 1),"ANY")){
echo "passed dns check";
return TRUE;
}
}
echo "FALSE<BR>";
return FALSE;
}