发送邮件

时间:2016-04-05 08:55:23

标签: php email

我发送邮件并使用wordpress SMTP插件,但我有一个问题,每次我发送邮件时,在调试输出上我看到发送的X-Priority标头使我的MQS随SpamAssassin丢弃

我设置了$phhmailer->SMTPDebug=false;并将优先级设置为null,但它并没有改变任何内容。

调试输出的部分如下所示:

 ["MIMEHeader":protected]=>
  string(443) "Date: Tue, 5 Apr 2016 08:44:48 +0000
Return-Path: 
To: web-z4CIb1@mail-tester.com
From: Example
Subject: WP Mail SMTP: Test mail to web-z4CIb1@mail-tester.com
Message-ID: <2edb8cb56706f6d09a29b49a66cf1ff0@example.com>
X-Priority: 
X-Mailer: PHPMailer 5.2.7 (https://github.com/PHPMailer/PHPMailer/)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

3 个答案:

答案 0 :(得分:1)

经过相当多的讨论后,我设法通过打开phpmailer类文件来解决问题,并注释掉以下行:

$result .= $this->headerLine('X-Priority', $this->Priority);

这完全删除了X-Priority标头。

答案 1 :(得分:0)

如果从标题中删除了X优先级,则电子邮件将作为优先级2(正常)处理。您可以将其设置为2吗?

,而不是删除标题项

您应该可以使用$mail->Priority = null;取消设置标头 根据{{​​3}}在GitHub上的结论。

还可能有其他因素影响您的垃圾邮件分数,而不仅仅是空的优先级变量。

答案 2 :(得分:0)

Setting the $mail->Priority = null; is the correct solution (or do not set it at all as the default is null). However, in order for it to work you will also need to make sure you have a version of PHPMailer that has been updated with this patch.