Re: Regex for email validation
| From: | Micah Gersten | Date: | Wed, 27 Aug 2008 07:35:28 +0000 |
| Subject: | Re: Regex for email validation | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-278761@lists.php.net to get a copy of this message | ||
That's a very handy extension.
Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com
mike wrote:
>
> php should have a good check built-in.
>
> see http://www.php.net/manual/en/function.filter-var.php
>
> if(!filter_var($var, FILTER_VALIDATE_EMAIL)) {
> echo "invalid email";
> }
>
> some people also go the extra mile and verify the MX record is valid,
> or lookup the MX record and even validate the user exists by querying
> the mail server.
>
>