"Reply-To:" not functioning
Posted: Thu Oct 05, 2006 8:39 pm
Hi,
I've set-up an email form that sends variables to the attached PHP script. The message is sent OK. The only problem is the "Reply-To" feature. When I click Reply in my email account on receipt of a message sent via the form the address in the 'Reply' field of my email is X-Mailer: PHP/4.3.11@linhost199.prod.mesa1.secureserver.net rather than the email address contained in the $yourname variable.
Any ideas about what I'm doing wrong? I've tried swapping the order of the headers around a bit but it doesn't seem to solve the problem.
Many, many thanks,
leo
I've set-up an email form that sends variables to the attached PHP script. The message is sent OK. The only problem is the "Reply-To" feature. When I click Reply in my email account on receipt of a message sent via the form the address in the 'Reply' field of my email is X-Mailer: PHP/4.3.11@linhost199.prod.mesa1.secureserver.net rather than the email address contained in the $yourname variable.
Any ideas about what I'm doing wrong? I've tried swapping the order of the headers around a bit but it doesn't seem to solve the problem.
Many, many thanks,
leo
Code: Select all
<?
$to = 'myname@mydomain.org';
$subject = 'St. Patrick\'s message';
$body = "You have received a message via the St. Patrick's website. The details of the message are listed below...\n\nName: $yourname\nEmail: $youremail\nMessage: $yourmessage";
$body = wordwrap($body, 70);
$headers = "Content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= "From: myname@mydomain.org\r\n";
$headers .= "Return-Path: myname@mydomain.org\r\n";
$headers .= "Reply-To: $youremail";
$headers .= 'X-Mailer: PHP/' . phpversion()."\r\n";
mail($to, $subject, $body, $headers, "-fmyname@mydomain.org");
?>