Hello allanch08, , I have seen many many different attempts on "How To validate Email" web pages for php, with the preg_match or other preg functions, many of these were based on an older standard than the RFC 5322. For me none of them did a great job, but they all worked to some extent. I now use the php filter_var( ) to validate email, this seems to give good results. You can validate with the FILTER_VALIDATE_EMAIL, and also it offers the FILTER_SANITIZE_EMAIL , which can be helpful.
I will include code for a "Test" page in php
Main Topics
Browse All Topics





by: OdengrPosted on 2009-08-18 at 09:06:37ID: 25124683
You code doesnt check for domains, only for username.
I use this code to validate an email address.
If is valid returns an array with username + hostname.
use implode("@", $array) to merge them.
Else return false.
Hope I helped you!
Select allOpen in new window