Re: email address syntax checker
| From: | Nisse Engström | Date: | Fri, 21 Jan 2011 00:25:01 +0000 |
| Subject: | Re: email address syntax checker | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-310934@lists.php.net to get a copy of this message | ||
On Thu, 20 Jan 2011 19:03:22 +0530, Nilesh Govindarajan wrote:
> Well, I had created an email validator long ago, after a neat research
> on Google, reading RFCs, etc.
> I don't guarantee that it's without bugs, but it has been correct for me
> in all valid & invalid email addresses I used for test.
>
> Code:
>
> <?php
>
> function checkMail($mail) {
>
> if(strlen($mail) <= 0) {
> return false;
> }
>
> $split = explode('@', $mail);
>
> if(count($split) > 2) {
> return false;
> }
<"@"@example.com> is not a valid address?
/Nisse