I am utilizing a PHP contact page which is delivering mail to non gmail addresses, however, if I place it to transmit to some gmail address, it does not get shipped (it does not even come in spam).

I have heard about issues such as this before - I am not really a webmasterOrprofessional so can anybody suggest code/configuration changes to my PHP contact page below which may basically mean messages get shipped to gmail addresses?

I am on the linux/WHM devoted server.

<?php
error_reporting(E_NOTICE);

function valid_email($str)
{
    return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;
}

if(!empty($_POST['name']) && !empty($_POST['email']) && valid_email($_POST['email']) === true && !empty($_POST['comment']))
{


    $to = "contactform@gmail.com";
    $headers =     'From: '.$_POST['email'].''. "\r\n" .
            'Reply-To: '.$_POST['email'].'' . "\r\n" .
            'X-Mailer: PHP/' . phpversion();
    $subject = "Contact Form";
    $message = htmlspecialchars($_POST['comment']);

    if(mail($to, $subject, $message, $headers))
    {
        echo 1; //SUCCESS
    }
    else {
        echo 2; //FAILURE - server failure
    }
}
else {
    echo 3; //FAILURE - not valid email
}
?> 

Have you determine in case your PHP installation/server props up Mail() function?

Also have you determine if Gmail is dealing with your emails as junk e-mail? (they wont display in the junk e-mail folder, they're just blocked)... Try delivering it to another address.

Set your script to transmit it from their email which has a real mailbox somewhere so that you can look for bounces. In case your script echoing 1, and may send with other addresses it indicates (in my experience a minimum of), it's gmail not liking you, instead of anything wrong using the script by itself.

Additionally, it appears like you have to consider safeguarding this script from email injection. Only a suggestion though.