vendredi 10 avril 2015

Wordpress not recieving contact form email

I have a website I'm working on with a contact form. Simple Name, Email, and Message fields. However, I'm not receiving the email from the form; though I do get the "Message Sent" success option.


I had found a way to test wp_mail to see if that was it, using http://ift.tt/1CrwoMz and that works just fine - so I have no clue what the problem is.



<?php

//loading wordpress functions
require( '../../../wp-load.php' );


define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');


$to = get_option('admin_email'); //Enter your e-mail here.
$subject = get_theme_option(tk_theme_name.'_contact_contact_subject');

$from = $_POST['contactname'];
$name = $_POST['email'];
$message = $_POST['message'];
$headers = "From: $name <$from>\n";
$headers .= "Reply-To: $subject <$from>\n";
$return = $_POST['returnurl'];
$sitename =get_bloginfo('name');

$body = "You received e-mail from ".$from." [".$name."] "." using ".$sitename."\n\n\n".$message;

$send = wp_mail($to, $subject, $body, $headers) ;


if($send){
wp_redirect($return.'?sent=success');
}else{
wp_redirect($return.'?sent=error');

}

?>


As I said, it does hit



wp_redirect($return.'?sent=success')


so I have no clue what is wrong.


Aucun commentaire:

Enregistrer un commentaire