I'm using a theme that has a built in contact form, which has some options (like where the form is sent) set through the OptionTree plugin.
What's happening is, the email gets sent, but the reply-to is a made-up server address at the webhost, rather than what the visitor's self-stated email is. This is really weird.
When I look at the code, it all seems sound:
//If there is no error, send the email
if(!isset($hasError)) {
$emailTo = get_option_tree( 'contact_page_email' ); /*Put your own email address here*/
$body = "Name: $name \n\nEmail: $email \n\nSubject: $subject \n\nComments:\n $comments";
$headers = 'From: My Site <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
mail($emailTo, $subject, $body, $headers);
$emailSent = true;
}
It looks like the code is supposed to set reply-to to be the person's stated email address. But our mail server, for some reason, wants to set the reply for all form responses to a server-generated address. The reply-to address ends up being [email protected].
Does anyone have any ideas why this might be happening? The code looks sound to me -- I just can't figure out why when we receive mail from the server from the contact form, it appears to come from an address that isn't the client's email.
Thanks!
Rob
wp_mail()
, notmail()
.