Validate Email Addresses Using PHP

by satheeshkumar 2012-08-17 22:43:09

Validate Email Addresses Using PHP


//$email = "abc123@lolhaha"; // Invalid email address
$email = "somebody@somesite.com"; // Valid email address
$regex = '/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([comco.in])+$/';

if (preg_match($regex, $email))
{
echo "Email is valid";
}
else
{
echo "invalid email";
}
?>
980
like
0
dislike
0
mail
flag

You must LOGIN to add comments