显示名称而不是电子邮件的电子邮件标题的格式是什么?

2024-02-27

我正在尝试创建一个 php 脚本,该脚本将使用 mySQL 数据库为我处理邮件列表,并且我已经准备好了大部分内容。不幸的是,我似乎无法让标题正常工作,而且我不确定问题是什么。

$headers='From: [email protected] /cdn-cgi/l/email-protection \r\n';
$headers.='Reply-To: [email protected] /cdn-cgi/l/email-protection\r\n';
$headers.='X-Mailer: PHP/' . phpversion().'\r\n';
$headers.= 'MIME-Version: 1.0' . "\r\n";
$headers.= 'Content-type: text/html; charset=iso-8859-1 \r\n';
$headers.= "BCC: $emailList";

我在接收端得到的结果是:

“noreply”@rilburskryler.net rn回复:否[电子邮件受保护] /cdn-cgi/l/email-protection:PHP/5.2.13rnMIME-版本:1.0


要显示姓名(而不是显示电子邮件地址),请使用以下命令:

"John Smith" <[email protected] /cdn-cgi/l/email-protection>

Easy.

关于断行符,这是因为您将文本括在撇号而不是引号中:

$headers = array(
  'From: "The Sending Name" <[email protected] /cdn-cgi/l/email-protection>' ,
  'Reply-To: "The Reply To Name" <[email protected] /cdn-cgi/l/email-protection>' ,
  'X-Mailer: PHP/' . phpversion() ,
  'MIME-Version: 1.0' ,
  'Content-type: text/html; charset=iso-8859-1' ,
  'BCC: ' . $emailList
);
$headers = implode( "\r\n" , $headers );
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

显示名称而不是电子邮件的电子邮件标题的格式是什么? 的相关文章