php – 如何正确添加List-Unsubscribe标头?

前端之家收集整理的这篇文章主要介绍了php – 如何正确添加List-Unsubscribe标头?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在LAMP堆栈上使用Postfix邮件服务器.我使用PHPmailer发送邮件.我最近注意到主要的ISP已经添加了对“List-Unsubscribe”标题支持.根据Hotmail,live自动添加一个

You’re subscribed to this mailing list. Unsubscribe

检查我的Facebook邮件时我注意到了这一点.所以当我检查Facebook标题时,我注意到了这一行

List-Unsubscribe: <mailto:unsub+engage_digest_email@unsubscribe.facebook.com>
X-Priority: 3
X-Mailer: ZuckMail [version 1.00]
X-Facebook-Camp: engage_digest_email
X-Facebook-Notify: engage_digest_email; mailid=523199eG1fe9e7abG0Gd4
List-Unsubscribe: <mailto:unsub+engage_digest_email@unsubscribe.facebook.com>
Errors-To: update+pmhd_um@facebookmail.com
X-FACEBOOK-PRIORITY: 1

因此,通过我的PHPmailer设置,我添加了addCustomHeader()函数.

$x = new PHPMailer();
$x->From = "support@veepiz.com";
$x->FromName = "Veepiz Support";
$x->AddAddress($o->emailaddress,$o->toname);
$x->AddReplyTo("support@veepiz.com","Veepiz Support");
$x->WordWrap = 80;                                 // set word wrap to 50 characters
$x->IsHTML(true);                                  // set email format to HTML
$x->IsSMTP();
$x->Host = "veepiz.com";
$x->Username = 'support@veepiz.com';
$x->Password = 'xxxxxxxx';                
$x->Subject = $o->subject;
$x->Body    = $o->content."\n\n<span style='color:white'>Forgotten your password? go to <a href='http://www.veepiz.com/forgot.PHP'>http://www.veepiz.com/forgot.PHP</a></span>";
$x->Body    = str_replace("\r","\n",wordwrap($x->Body,80));
$x->AltBody = $o->plain_text;
$x->AltBody = str_replace("\r",wordwrap($x->AltBody,80));
$x->AddCustomHeader("List-Unsubscribe: <mailto:unsubscribe@veepiz.com?subject=Unsubscribe>,<http://www.veepiz.com/unsubscribe.PHP?unsubscribeid=$ox->id>");

现在,当我发送邮件时,我在邮件标题中得到了这个…

List-Unsubscribe: <mailto:unsubscribe@veepiz.com?subject=Unsubscribe>,<http://www.veepiz.com/unsubscribe.PHP?unsubscribeid=1>

似乎PHPmailer正在添加此标头,它符合rfc http://www.list-unsubscribe.com/

但是在Hotmail中我没有得到组件显示我已经订阅了blah blah邮件列表取消订阅

You’re subscribed to this mailing list. Unsubscribe

所以你应该问Hotmail.它们可能仅针对受信任的简报或发件人显示该组件.谁告诉你他们为任何包含“List-Unsubscribe:”标题邮件显示内容.

网络钓鱼者和垃圾邮件发送者可以使用此标题来使邮件更严重. Hotmail很有可能只接受来自可信站点的这些标头.

原文链接:https://www.f2er.com/php/138918.html

猜你在找的PHP相关文章