验证完整的联系页面

<?php

if (isset($_POST["sendMessage"])) {
    $firstName = trim($_POST['firstName']);
    $lastName = trim($_POST['lastName']);
    $email = trim($_POST['email']);
    $phone = trim($_POST['phone']);
    $message = trim($_POST['message']);
    $from = 'somebody@gmail.com';
    $to = 'someone@gmail.com';
    $subject = 'webmaster@example.com';
    $txt = 'Prottyasha School';
    $headers = "From: somebody@gmail.com" . "
" .
        "CC: somebody@gmail.com";
    $body = "From: First-Name: $firstName
 Last-Name: $lastName


E-Mail: $email
 Phone: $phone
 Message: $message";
    //echo "success?";


    if (mail($to, $subject, $body, $headers)) {
        $result = '<div class="alert alert-success">Thank You! I will be in touch</div>';
    } else {
        $result = '<div class="alert alert-danger">Sorry there was an error sending your message. Please try again later</div>';
    }

    echo $result;
}

?>

It works fine but i want to make it validated. suppose someone give a invalid phone number or email then it will message its invalid mail or phone number. i want to make it full validated. anyone please help me.

I don't think it's possible to check if the mail was successfully delivered. mail() returns boolean true when a mail has been accepted for delivery or sent to the local email service. There's no way to know if that email was delivered to the recipient.