I'm building a website that sends and email to a user when he registers.
My code (the gist of it):
<?php
$to = "helloworld@gmail.com";
$subject = "Test mail";
$message = "Hello!
This is a simple email message.";
$headers = "From: munged@gmail.com";
$headers .= "
Reply-To: munged@gmail.com";
$headers .= "
X-Mailer: PHP/".phpversion();
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
the problem is that when the mail is delivered, the from header remains munged@box123.bluehost.com
, while reply-to gets changed to the specified value.
box123.bluehost.com
is the hostname of the server on which the website is hosted.
So what am I doing wrong? What can I do to get the "From" address the same as the reply-to address?
Is it something I'm doing wrong, or is the web host playing foul?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…