Here’s the absolute easiest way you can validate an email address using PHP. This tiny function takes advantage of the filter_var() function in PHP.
Code
$email = test_input($_POST["email"]);
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$message = "Invalid email format";
}