【问题标题】:How add List-Unsubscribe header to native mail() function of PHP如何将 List-Unsubscribe 标头添加到 PHP 的本机 mail() 函数
【发布时间】:2021-03-31 19:48:44
【问题描述】:

我已经在https://www.mail-tester.com/ 上测试了我的垃圾邮件评分。这很好,但作为一种改进,它建议:

您的消息不包含 List-Unsubscribe 标头 如果您发送大量电子邮件,则需要 List-Unsubscribe 标头,它 使用户能够轻松地从您的邮件列表中退订。

如何将它添加到 PHP 的原生 mail(); 函数中。或者甚至有可能这样吗? (我在 www 上找不到一个简单的例子)。

【问题讨论】:

标签: php function email native list-unsubscribe


【解决方案1】:

您可以使用mail() 函数添加其他标题。

$headers = [
    'From: thisisme@example.net',
    'List-Unsubscribe: <mailto:thisisme@example.net?subject=unsubscribe>'
];

$body = 'I am the newsletter content.';

mail('recipent@example.net', 'Subject of newsletter', $body, implode("\r\n", $headers));

【讨论】:

  • 非常感谢!
猜你喜欢
  • 2012-07-21
  • 2019-08-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-07-17
  • 1970-01-01
相关资源
最近更新 更多