1
//send email

        $to = $_POST['email'];

        $subject = "Welcome!";

        $body = "Contains sensitive information that activates users so I've removed it.";

        $additionalheaders = "From: <".SITEEMAIL.">\r\n";

        $additionalheaders .= "Reply-To: ".SITEEMAIL."";

        mail($to, $subject, $body, $additionalheaders);

Basically the above code successfully sends an email, and in the inbox it displays as noreply@mydomain which is fine, but I've noticed that other sites show actual names. Like messages from Facebook say Facebook not noreply@facebook.com. Is there a header I am missing to accomplish this?

EDITED TO SHOW ANSWER:

//send email

        $to = $_POST['email'];

        $subject = "Welcome!";

        $body = "Contains sensitive information that activates users so I've removed it.";

        $additionalheaders = "From: Name <".SITEEMAIL.">\r\n";

        $additionalheaders .= "Reply-To: ".SITEEMAIL."";

        mail($to, $subject, $body, $additionalheaders);

1 Answers1

4
from: Jon Jones <Jon@Jones.com>
Andrew Larsen
  • 1,257
  • 10
  • 21