I am doing website maintenance for a client who had another designer design the site. I am having a hard time figuring out why the contact form is not working on my client’s website. It says it is sent when you click submit but, we never receive the email. The email is working fine as I have sent an email to that email from my personal acct and it works. I also have uploaded a sample form script and that sends right away. So I know it has to be the script. Can someone please look at the code and tell me what I need to fix. Thanks.
[php]
<!-- The contact form starts from here-->
<?php
$error = ''; // error message
$name = ''; // sender's name
$email = ''; // sender's email address
$subject = ''; // subject
$message = ''; // the message itself
if(isset($_POST['send']))
{
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
if(trim($name) == '')
{
$error = '<div class="errormsg">Please enter your name!</div>';
}
else if(trim($email) == '')
{
$error = '<div class="errormsg">Please enter your email address!</div>';
}
else if(!isEmail($email))
{
$error = '<div class="errormsg">You have enter an invalid e-mail address. Please, try again!</div>';
}
if(trim($subject) == '')
{
$error = '<div class="errormsg">Please enter a subject!</div>';
}
else if(trim($message) == '')
{
$error = '<div class="errormsg">Please enter your message!</div>';
}
if(get_magic_quotes_gpc())
{
$message = stripslashes($message);
}
// the email will be sent here
// make sure to change this to be your e-mail
$to = "*******@farrbetterplumbing.com";
// the email subject
// '[Contact Form] :' will appear automatically in the subject.
// You can change it as you want
$subject = '[Contact Form] : ' . $subject;
// the mail message ( add any additional information if you want )
$msg = "From : $name \r\ne-Mail : $email \r\nSubject : $subject \r\n\n" . "Message : \r\n$message";
mail($to, $subject, $msg, "From: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n");
}
?>
<!-- Message sent! (change the text below as you wish)-->
<div style="text-align:center;">
<h1>Congratulations!!</h1>
<p>Thank you <b><?=$name;?></b>, your message is sent!</p>
</div>
<!--End Message Sent-->
<?php
if(!isset($_POST['send']) || $error != '')
{
}
?>[/php]