开发者

How to make from-name in email appear with a space using PHP?

开发者 https://www.devze.com 2023-03-14 14:25 出处:网络
I am currently sending text email in PHP and doing something like this: $from = \"from: Hike Attendance Update@comehike.com\";

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>";
0

精彩评论

暂无评论...
验证码 换一张
取 消