How to make from-name in email appear with a space using PHP?
I am currently sending text email in PHP and doing something like this:
$from = "from: Hike Attendance Update@comehike.com";
$to_email_address = 'some email';
$subject = 'Some subject';
$conte开发者_运维问答nts = 'Blah';
mail($to_email_address, $subject, $contents, $from);
When I send it, it appears as sent from Hike.Attendance.Update which doesn't look very good. How can I make it appear with spaces instead of dots?
Thanks, Alex
Try:
$from = "from: \"Hike Attendance\" <Update@comehike.com>";
I think that's specified in some RFC for email, namely RFC 5322.
When specifying the actual name, put the email address in <> chars:
$from = "from: Hike Attendance <Update@comehike.com>";
精彩评论