RE: [PHP] testing an email address
| From: | Matthew Luchak | Date: | Fri, 12 Oct 2001 18:35:34 +0000 |
| Subject: | RE: [PHP] testing an email address | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-70946@lists.php.net to get a copy of this message | ||
From the docs....
getmxrr
ssmith@personalcarehmo.com
27-Oct-2000 05:05
A common use of this function is to check the validity of an email
address. Through trial and error, I have found that this works fairly
well, although it does not check for the existence of the actual user;
rather, it verifies the existence of any and all domains associated with
the address.
function email_is_valid ($email) {
if
(eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}
$", $email, $check)) {
if ( getmxrr(substr(strstr($check[0], '@'), 1), $validate_email_temp) )
{
return TRUE;
}
// THIS WILL CATCH DNSs THAT ARE NOT MX.
if(checkdnsrr(substr(strstr($check[0], '@'), 1),"ANY")){
return TRUE;
}
}
return FALSE;
}
____________________________
Matthew Luchak
Webmaster
Kaydara Inc.
mluchak@kaydara.com
-----Original Message-----
From: Marc Pozzuoli [mailto:p@XRentDVD.com]
Sent: Friday, October 12, 2001 2:33 PM
To: php-general@lists.php.net
Subject: RE: [PHP] testing an email address
This post made me wonder. Is it possible to test the domain of the
email to
see if it is a valid domain? This could help with typos on the users
part.
Thanks,
P