Annabell Archer
New member
I'm adding php mail to a website. When I send an email from the site, everything works just fine but the sender email doesn't show up in the body of the email on the receiving end. Name, phone number and body all show but now the email address. This is what the code looks like. Can someone tell me where I went wrong? If there is a syntax error I sure don't see it.
<?php
$to = "[email protected]";
$subject = "New Email!";
$body .= 'Name: ' . $_POST['name'] . "\r\n";
$body .= 'Phone: ' . $_POST['phone'] . "\r\n";
$body .= 'Email: ' . $_POST['email'] . "\r\n\r\n";
$body .= $_POST['comment'];
$headers = 'From: ' . $_POST['email'] . "\r\n";
'Reply-To: ' . $_POST['email'] . "\r\n";
if(mail($to, $subject, $body, $headers))
echo "Successful! Thank you for your inquiry. We will get back to you shortly.";
else
echo "We apologize. There was a problem. Please try again later.";
?>
Jim, excellent! It worked about half way. the email now shows up in the "from" category of the inbox but when the message is opened, the email address that the person actually has to type in manually (their own address) still doesn't show up in the body. Its this particular line that is giving me trouble now.
$body .= 'Email: ' . $_POST['email'] . "\r\n\r\n";
any suggestions there?
<?php
$to = "[email protected]";
$subject = "New Email!";
$body .= 'Name: ' . $_POST['name'] . "\r\n";
$body .= 'Phone: ' . $_POST['phone'] . "\r\n";
$body .= 'Email: ' . $_POST['email'] . "\r\n\r\n";
$body .= $_POST['comment'];
$headers = 'From: ' . $_POST['email'] . "\r\n";
'Reply-To: ' . $_POST['email'] . "\r\n";
if(mail($to, $subject, $body, $headers))
echo "Successful! Thank you for your inquiry. We will get back to you shortly.";
else
echo "We apologize. There was a problem. Please try again later.";
?>
Jim, excellent! It worked about half way. the email now shows up in the "from" category of the inbox but when the message is opened, the email address that the person actually has to type in manually (their own address) still doesn't show up in the body. Its this particular line that is giving me trouble now.
$body .= 'Email: ' . $_POST['email'] . "\r\n\r\n";
any suggestions there?