Please help me with my contact form. This form does give the message that the mail has been sent but there is nothing received in my email. There’s no problem with my hosting company (Godaddy). Please help
Here is my Contact Form
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- Javascript Start //-->
<script type="text/javascript" src="js/contact-form.js"></script>
<!-- Javascript End //-->
</head>
<body>
<!-- Contact Form -->
<div id="conctactleft">
<h4>Get in Touch with Us!</h4>
<div id="maincontactform">
<form action="./sendemail.php" id="contactform" />
<div>
<label for="contactname">Name</label>
<input type="text" name="contactname" class="textfield" id="contactname" value="" /><span class="require"> *</span>
<label for="contactsubject">Subject</label>
<input type="text" name="contactsubject" class="textfield" id="contactsubject" value="" /><span class="require"> *</span>
<label for="contactemail">Your E-mail</label>
<input type="text" name="contactemail" class="textfield" id="contactemail" value="" /><span class="require"> *</span>
<label for="contactmessage">Your Message</label>
<textarea name="contactmessage" id="contactmessage" class="textarea" cols="8" rows="12"></textarea><span class="require"> *</span>
<div class="clear"></div>
<a href="javascript: submitform()" class="button" id="buttonsend"><span>SEND</span></a>
<span class="loading" style="display: none;">Please wait..</span>
</div>
</form>
</div>
</div>
<!-- Contact Form End -->
</body>
</html>
Here is my sendemail.php file
<?php
$mailto = "myemailaddress@gmail.com";
$name = ucwords($_POST['name']);
$subject = $_POST['subject']; // Enter the subject here.
$email = $_POST['email'];
$message = $_POST['message'];
if(strlen($_POST['name']) < 1 ){
echo 'email_error';
}
else if(strlen($email) < 1 ) {
echo 'email_error';
}
else if(strlen($message) < 1 ){
echo 'email_error';
} else {
if(!isValidEmail($email)) { echo "email_error"; exit; }
//subject and the html message
$messages = '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
<table>
<tr><td valign="top"><b>Name</b></td><td valign="top">:</td><td valign="top">' . stripslashes($name) . '</td></tr>
<tr><td valign="top"><b>Mail</b></td><td valign="top">:</td><td valign="top">' . $email . '</td></tr>
<tr><td valign="top"><b>Subject</b></td><td valign="top">:</td><td valign="top">' . stripslashes($subject) . '</td></tr>
<tr><td valign="top"><b>Message</b></td><td valign="top">:</td><td valign="top">' . stripslashes($message) . '</td></tr>
</table>
</body>
</html>';
$headers = "MIME-Version: 1.0" . "
";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "
";
$headers .= "From: " . stripslashes($name) . " <" . $email . ">" . "
";
$headers .= "Sender-IP: " . $_SERVER["SERVER_ADDR"] . "
";
$headers .= "Priority: normal" . "
";
$headers .= "X-Mailer: PHP/" . phpversion();
$Message_Body = utf8_decode($messages);
//send the mail
( $mailto, $subject, $Message_Body, $headers );
$susu = __('Thanks, your message was successfully sent!');
echo $susu;
exit;
}
function isValidEmail($email){
return eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email);
}
?>
Here is my contact-form.js file
$(document).ready(function() {
$('#buttonsend').click( function() {
var name = $('#name').val();
var subject = $('#subject').val();
var email = $('#email').val();
var message = $('#message').val();
$('.loading').fadeIn('slow');
if (name != "" && subject != "" && email != "" && message != "")
{
$.ajax(
{
url: '../sendemail.php',
type: 'POST',
data: "name=" + name + "&subject=" + subject + "&email=" + email + "&message=" + message,
success: function(result)
{
$('.loading').fadeOut('fast');
if(result == "email_error") {
$('#email').css({"border":"1px solid #FF8C8C"}).next('.require').text(' !');
} else {
$('#name, #subject, #email, #message').val("");
$('<div class="success">Your message has been sent successfully. Thank you! </div>').insertBefore('#maincontactform');
$('.success').fadeOut(5000, function(){ $(this).remove(); });
}
}
}
);
return false;
}
else
{
$('.loading').fadeOut('fast');
if( name == "") $('#name').css({"background":"#FFFCFC","border":"1px solid #FFD1D1"}).next('.require').text(' !');
if(subject == "") $('#subject').css({"background":"#FFFCFC","border":"1px solid #FFD1D1"}).next('.require').text(' !');
if(email == "" ) $('#email').css({"background":"#FFFCFC","border":"1px solid #FFD1D1"}).next('.require').text(' !');
if(message == "") $('#message').css({"background":"#FFFCFC","border":"1px solid #FFD1D1"}).next('.require').text(' !');
return false;
}
});
$('#name, #subject, #email,#message').focus(function(){
$(this).css({"background":"#ffffff","border":"1px solid #dcdcdc"}).next('.require').text(' *');
});
});
Kindly guide me what am I missing in this form. Thank you very much.