当我已经将 headers 设置为 "Content-type: text/plain" 时,如何防止电子邮件被视为 HTML

How to prevent the email from being considered HTML, when I've already set the headers as "Content-type: text/plain"

我想弄清楚为什么我的电子邮件被 hotmail 视为垃圾邮件,所以我使用了一个名为 mail-tester.com.

的在线工具

根据它,我有 8.4 分(满分 10 分),但问题之一是 SpamAssasin 检测到 "Message only has text/html MIME parts",它添加了 "You should also include a text version of your message (text/plain)" 并指向 link spamAssasin 规则“MIME_HTML_ONLY

我的问题是:我正在使用 phpMailer 发送电子邮件。我的电子邮件未列入黑名单,hotmail 只会出现这种情况。

我将 headers 设置为 text/plain。

我正在将电子邮件内容放入 strip_tags() 函数。

为什么说我要发送 HTML?

这就是我正在使用的(整个脚本很长,但这是发送电子邮件的相关部分。我在其他电子邮件客户端(如 gmail)中确实收到了没有问题的电子邮件。

require $_SERVER['DOCUMENT_ROOT'].'/phpMailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'mail.mysite.online';
$mail->SMTPAuth = true;
$mail->Username = 'info@mysite.online';
$mail->Port = 25;
$mail->CharSet = 'UTF-8';
$headers .= 'Content-type: text/plain'; 

$mensajeLimpio = strip_tags($resultado['mailMensaje']);
$mail->addAddress($pedidoEmail);
$mail->Subject = $resultado['mailAsunto'];
$mail->Body    = 'Estimado/a '.$nombreUsuario.',<br>'.$mensajeLimpio;

$mail->IsHTML(false); 添加到您的选项中