i am posting to a mailer.php file.
mailer.php
<?php
if(isset($_POST['submit'])) {
$to = "testabc@gmail.com";
$subject = "Contact via website";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";
echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "blarg!";
}
?>
here is my js code
$('.submit').click(function(){
$('span.msg').css({'visibility': 'visible'}).text('Sending...');
$.post("mailer.php", $(".contactPage").serialize(),
function(data){
$('span.msg').text('Your Message has been received. Thank you').show();
});
return false;
});
I am getting message of success but email is not received. What i am doing wrong? How to get error detail from mailer.php file and showing in span.msg?
JS: