Website Design United States, Website Design California, Website Designing United States, Website Designing California

Email Address Check - PHP

If you've ever needed to check a submitted email address to make sure it was in proper form before sending an email, this PHP function may be helpful.

Listed in the check are the generic Top Level Domains listed by ICANN and IANA. There's also a generic check for a two character country code (like .fr for France or .be for Belgium.

The function will also check to make sure the domain name is in proper form. A max of 63 characters is allowed including ASCII letters (case insensitive), digits, and hyphens.

The function will return TRUE if the email is in proper form and FALSE if it is not.

Example Use:

$email = "";

if(check_email($email)){ echo "Valid."; }else{ echo "Invalid."; }

function check_email($email){
if (ereg(
"^[^@ ]+@([a-zA-Z0-9.\-]{1,63})(\.)+([a-zA-Z0-9\-]{2}|aero|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro)\$",
return TRUE;
return FALSE;

42 B Malviya Nagar , New Delhi-110017

Skype: manmeetsi
Tel: 91-011-40502005, 9810067295



© 2008-2009