New to WP and PHP:
I'm trying to send an email with AJAX. My wp_mail is returning true and I'm receiving no errors on GoDaddy where I'm hosting, but the email is never actually received. Here's my php function :
add_action("wp_ajax_send_email", "send_email");
add_action("wp_ajax_nopriv_send_email", "send_email");
function send_email() {
$to = "[email protected]";
$subject = "Hey";
$message = "Hello";
$headers = "From: [email protected]";
if (wp_mail($to, $subject, $message, $headers)) {
echo json_encode(array('status' => 'success', 'message' => 'Contact message sent.'));
exit;
} else {
echo json_encode(error_get_last());
}
}
I do recieve the success message in my JS.
'message' => print_r( $GLOBALS['phpmailer'], true )
to see a more detailed report.