繁体   English   中英

php邮件“ FROM”标头中的&

[英]ampersand in php mail “FROM” header

好吧,我很沮丧。 我有一个客户的公司名称带有“&”号。 就像“ Bill&Bob Associates”。 所以,我有一个像这样的from行:

 $headers  = "From: Bill & Bob Associates, LLC <info@billbob.com>\r\n";

&在这样的电子邮件中突破了;

From: info@host.webhost.com,
&@host.webhost.com, Associates@host.webhost.com,
LLC <info@billbob.com>

尝试%26,但没有用。

任何帮助,将不胜感激。

可能像:

$headers = "From: ". mb_encode_mimeheader('Bill & Bob Associates, LLC', 'UTF-8', 'Q') ." <info@billbob.com>\\r\\n";

或者您可以尝试:

$headers = "From: =?UTF-8?B?". base64_encode('Bill & Bob Associates, LLC') ."?= <info@billbob.com>\\r\\n"

@nanocv在正确的轨道上,但是字符串已经用双引号引起来了。 但是,使用单引号并在名称周围加上双引号可以解决问题,如下所示:

$headers    = 'From: "Bill & Bob, LLC" <ino@billbob.com>\r\n';

现在来看,这是有道理的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM