I have send email funciton on my home.php wordpress file and function is below
$("#sendmailbtn").click(function(e) {
var dataString = $(".pricing").html();
e.preventDefault();
var grandTotal = localStorage.getItem("GrandTotal");
$.ajax({
type: "POST",
url: "/wp-admin/admin-ajax.php",
datatype: "html",
data: {'action': 'fahadsending_mail', 'more': dataString, 'grandTotal': grandTotal},
success: function(response) {
alert("success is " + response);
},error:function(response){
alert("error is " + response);
}
});
});
AND THE EMAIL CODE IN MY functions.php file is below where i am sending post to fahadsending_mail function but it ajax success function it alerts success is 0
add_action('wp_ajax_fahadsending_mail', 'fahadsending_mail');
add_action('wp_ajax_fahadsending_mail', 'fahadsending_mail');
function fahadsending_mail(){
$to = "[email protected]";
$subject = "Donation";
$message = "message message message message message message message ";
if(wp_mail($to, $subject, $message))
{
echo "mail sent";
} else {
echo "mail not sent";
}
}
and response comes in success function and it alert success is 0 and ajax post shows following action wplc_call_to_server_visitor cid 213 security 2f40c8e66f status 5 wplc_email no email set wplc_name Guest wplcsession 1456325128583