Is mail() working?

is there anything wrong with this PHP synrtax


...
...
<?php

if(!isset($hasError)) {

$name = $_POST['contactName'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$comments= $_POST['comments'];

$to= 'lukemaxpro@excite.com';
$subject = 'Contact Form Submission from '.$name;
$body = 'Name: '.$name." \
\
".'Email: '.$email." \
\
".'Comments: '.$comments;
$headers = 'From: My Site <'.$to.'>' . "\\r\
" . 'Reply-To: ' . $email;

mail($to, $subject, $body, $headers);

$emailSent = true;

}
?>
...
...

<?php if(isset($emailSent) && $emailSent == true) { ?>

    <div class="thanks">
        <h1 style="text-transform: none;">Thanks, <?=$name;?></h1>
        <p>Your email was successfully sent. I will be in touch soon.</p>
    </div>

<?php } ?>

and its at,
http://crowntownbob.com/contact/
but it doesn’t seem to work,

Thanks…

$emailSent = mail($to, $subject, $body, $headers);

did that and still nothing…
does this logic make sense?


<?php 
//If the form is submitted
if(isset($_POST['submitted'])) {
    //Check to make sure that the name field is not empty
    if(trim($_POST['contactName']) === '') {
        $nameError = 'You forgot to enter your name.';
        $hasError = true;
    } else {
            $name = trim($_POST['contactName']);
    }
    //Check to make sure sure that a valid email address is submitted
    if(trim($_POST['email']) === '')  {
        $emailError = 'You forgot to enter your email address.';
        $hasError = true;
    } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\\.[A-Z]{2,4}$", trim($_POST['email']))) {
            $emailError = 'You entered an invalid email address.';
            $hasError = true;
    } else {
            $email = trim($_POST['email']);
    }
    //Check to make sure comments were entered    
    if(trim($_POST['comments']) === '') {
        $commentError = 'You forgot to enter your comments.';
        $hasError = true;
    } else {
        $comments = trim($_POST['comments']);
    }
    //If there is no error, send the email
    if(!isset($hasError)) {
    echo 'email sent';
    $phone = $_POST['phone'];

    $to= 'lukemaxpro@excite.com';
    $subject = 'Contact Form Submission from '.$name;
    $body = 'Name: '.$name." \
\
".'Email: '.$email." \
\
".'Comments: '.$comments;
    $headers = 'From: My Site <'.$to.'>' . "\\r\
" . 'Reply-To: ' . $email;

    $emailSent = mail($to, $subject, $body, $headers);
    }
} ?>


k, is this better then (should is work (as in send an email?)



<?php
/*
Template Name: Bobs Contact Form
*/
?>


<?php get_header(); ?>

<div class="map">
<iframe width="480" height="494" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=Napolitano+Realty,+939+Orange+Avenue,+Coronado,+CA+92118-2609&amp;aq=2&amp;sll=37.0625,-95.677068&amp;sspn=40.409448,93.076172&amp;ie=UTF8&amp;hq=Napolitano+Realty,&amp;hnear=939+Orange+Ave,+Coronado,+San+Diego,+California+92118&amp;ll=32.686543,-117.179229&amp;spn=0.006295,0.006295&amp;output=embed"></iframe>
</div>


<?php

//If the form is submitted
if(isset($_POST['submitted']))
    {
    //Check to make sure that the name field is not empty
    if(!isset($_POST['contactName'])) {
        $nameError = 'You forgot to enter your name.';
        $hasError = true;
    } else {
        $name = trim($_POST['contactName']);
    }

    //Check to make sure sure that a valid email address is submitted
    $email = $_POST['email'];
    if(!filter_var($email, FILTER_VALIDATE_EMAIL))
    {
        $emailError = 'You entered an invalid email address.';
        $hasError = true;
    } 
    //Check to make sure comments were entered    
    if(!isset($_POST['comments']))
    {
        $commentError = 'You forgot to enter your comments.';
        $hasError = true;
    } else {
        $comments = trim($_POST['comments']);
    }
    //If there is no error, send the email
    if(!isset($hasError)) {
    echo 'email sent';
    $phone = $_POST['phone'];

    $to= 'example@example.com';
    $subject = 'Contact Form Submission from '.$name;
    $body = 'Name: '.$name." \
\
".'Email: '.$email." \
\
".'Phone: '.$phone." \
\
".'Comments: '.$comments;
    $headers = 'From: My Site <'.$to.'>' . "\\r\
" . 'Reply-To: ' . $email;

    $emailSent = mail($to, $subject, $body, $headers);
    } else {
    echo 'Error';
    }
    if(isset($emailSent)) {
?>
    <div class="thanks">
        <h1 style="text-transform: none;">Thanks, <?=$name;?></h1>
        <p>Your email was successfully sent. I will be in touch soon.</p>
    </div>

<?php }
} else { ?>


<div class="contact-form" style="padding:25px; float:left; margin-top: 50px;  background-color: rgba(195,166,96,.13); height: 444px; width: 400px;">
<h1 style="text-align:center; margin-left: -25px; margin-top: -25px; width: 420px; color: white; font: 700 30px/1.1 georgia,'times new roman','sans-serif'; text-transform: uppercase;">Contact Form</h1>
        <form action="<?php the_permalink(); ?>" id="contactForm" method="post">
    
            <ol class="forms" style="margin-top:25px; width:400px; clear:none; margin-left:0">
                <li><label for="contactName">Name</label>
                    <input type="text" name="contactName" id="contactName" value="<?php if(isset($_POST['contactName'])) echo $_POST['contactName'];?>" class="requiredField" />
                    <?php if($nameError != '') { ?>
                        <span class="error"><?=$nameError;?></span> 
                    <?php } ?>
                </li>
                <li><label for="email">Email</label>
                    <input type="text" name="email" id="email" value="<?php if(isset($_POST['email']))  echo $_POST['email'];?>" class="requiredField email" />
                    <?php if($emailError != '') { ?>
                        <span class="error"><?=$emailError;?></span>
                    <?php } ?>
                </li>
                <li><label for="phone">Phone</label>
                    <input type="text" name="phone" id="phone" value="<?php if(isset($_POST['phone']))  echo $_POST['phone'];?>"  />
                </li>
                   <li class="textarea"><label for="commentsText">Comments</label>
                    <textarea name="comments" id="commentsText" rows="10" cols="30" class="requiredField" style="height:150px"><?php if(isset($_POST['comments'])) { if(function_exists('stripslashes')) { echo stripslashes($_POST['comments']); } else { echo $_POST['comments']; } } ?></textarea>
                    <?php if($commentError != '') { ?>
                        <span class="error"><?=$commentError;?></span> 
                    <?php } ?>
                </li>
                <li class="screenReader"><label for="checking" class="screenReader">If you want to submit this form, do not enter anything in this field</label><input type="text" name="checking" id="checking" class="screenReader" value="<?php if(isset($_POST['checking']))  echo $_POST['checking'];?>" /></li>
                <li class="buttons"><input type="hidden" name="submitted" id="submitted" value="true" /><button type="submit" style="float: right; padding-top: 9px; padding-bottom: 8px; padding-left: 6px; padding-right: 6px; font-family: georgia, 'times new roman',sans-serif; background-color: #F47D3B; color: white; text-transform:uppercase">Submit</button></li>
            </ol>
        </form>
</div>    
<?php 
} 
?>

<?php get_footer(); ?>