如何使用PHP使电子邮件中的from name显示为带有空格


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

我目前正在用PHP发送文本电子邮件,并做如下操作:

$from = "from: Hike Attendance Update@comehike.com";
$to_email_address = 'some email';
$subject = 'Some subject';
$contents = 'Blah';
mail($to_email_address, $subject, $contents, $from);

当我发送它时,它看起来像是从Hike发送的。出席更新,看起来不太好。如何使其以空格而非点显示?

谢谢,Alex

尝试:

$from = "from: '"Hike Attendance'" <Update@comehike.com>";

我认为这是在一些电子邮件的RFC中指定的,即RFC 5322。

指定实际名称时,请将电子邮件地址放在<>字符:

$from = "from: Hike Attendance <Update@comehike.com>";