By admin, 1 year and 10 months ago
Email validity check
PHP code:
function is_email($email){ $x = '\d\w!\#\$%&\'*+\-/=?\^_`{|}~'; //just for clarity
return count($email = explode('@', $email, 3)) == 2 && strlen($email[0]) < 65 && strlen($email[1]) < 256 && preg_match("#^[$x]+(\.?([$x]+\.)*[$x]+)?$#", $email[0]) && preg_match('#^(([a-z0-9]+-*)?[a-z0-9]+\.)+[a-z]{2,6}.?$#', $email[1]);}
No comments
Be the first to write a comment on this post.
Write a comment
If you want to add your comment on this post, simply fill out the next form:
You have to be logged-in to write a comment: (Log-in).
No trackbacks
To notify a mention on this post in your blog, enable automated notification (Options > Discussion in WordPress) or specify this trackback url: http://www.tai.ro/2008/04/16/email-validity-check/trackback/