Just wondering why this is too strict, I can send very simplified emails to say tim@yahoo.com or two@google.com
but if I make the email any longer (sacagawea@gmail.com) it does not get sent.
Instead it echos back my error message:Invalid Email Address Supplied
// Create a function to check email
function checkEmail($email)
{
// Add some regex
return preg_match('/^\S+@[\w\d.-]{2,}\.[\w]{2,6}$/iU', $email) ? TRUE : FALSE;
}
This part
is gobbling up
leaving nothing for this part
to match.
Better to reuse something already proven, see for example http://www.regular-expressions.info/email.html