Re: email validation (no regex)
| From: | Manuel Lemos | Date: | Wed, 21 Sep 2005 18:43:21 +0000 |
| Subject: | Re: email validation (no regex) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-222903@lists.php.net to get a copy of this message | ||
Hello,
on 09/21/2005 02:49 PM Jim Moseby said the following:
I threw together this totally untested and unreliable code to solicit comments on whether or not this is a good way to validate emails. Consider
the following:
So, what is the general thought about validating email addresses in this manner?This may work but your code has several problems like not handling long lines, multiline SMTP responses and grey listing. That may cause your code to break with some SMTP servers or give false negatives. Instead of re-inventing the wheel, you may want to try this popular class for validation of e-mail addresses that can check the destination SMTP server but it handles correctly the problems I mentioned above: http://www.phpclasses.org/emailvalidation -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html