Re: E-mail address verification
| From: | Denis Arh | Date: | Thu, 20 Jun 2002 13:55:11 +0000 |
| Subject: | Re: E-mail address verification | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-19903@lists.php.net to get a copy of this message | ||
I do it like this:
if (eregi("^[a-z0-9]+([\.%!][_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$",
$email))
{
list($user, $host) = explode("@", $email);
if ( !checkdnsrr($host, "MX") )
return TRUE;
}
else
{
return FALSE;
}
}
As you can see, the email can "look" right, but domain isn't valid. So you
can check DNS record for MX domain.
Next step is to connect to mail server and verify user, but usualy that
takes time and it's better to send some kind of auth code to that mail and
if user conforms it, you can use it...
----- Original Message -----
From: <Gary.Every@ingramentertainment.com>
To: <php-db@lists.php.net>
Sent: Thursday, June 20, 2002 3:13 PM
Subject: [PHP-DB] E-mail address verification
> I'm looking for a good function that will allow me to verify that a valid
> e-mail address has been entered.
> I'm working with sales people that seem to get every possible problem
> entered into the field, such as:
>
> bill@here (no .com)
> bill@here .com (space, makes two email addresses!)
> bill@here,com (comma)
> bill
> bill@
> and the list goes on.
>
> Any input would be appreciated.
>
>
> Gary Every
> "Pay It Forward"
> mailto:gary.every@ingramentertainment.com
> http://accessingram.com
>