【发布时间】:2023-03-04 16:42:02
【问题描述】:
使用 PHPMailer 5.2.14,电子邮件以 text/html 格式发送。传出的文本每隔 75 个字符就会出现等号。
我尝试使用EOL workaround,但它没有删除多余的等号:
$email = new PHPMailer();
$email->From = 'from@example.com';
$email->FromName = 'FromUser';
$email->AddAddress( 'to@example.com' );
$email->Subject = 'This is a test';
$email->IsHTML(true);
$email->Body = "<p>This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. </p>";
// fix EOL here?
$email->LE = PHP_EOL;
$email->Send();
收到后的结果来源:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><font face="arial"><base href="http://example.com/"><!-- </base> -->=
<p>This is a test. This is a test. This is a test. This i=
s a test. This is a test. This is a test. This is a test.=
This is a test. This is a test. This is a test. Th=
is is a test. This is a test. This is a test. This is a t=
est. This is a test. This is a test. This is a test. =
</p></font>
在 Outlook 中查看时会出现等号。当我将相同的文本/html 发送到 gmail 帐户时,等号不存在。
需要采取什么措施来消除使用 Outlook 的收件人的这些杂散等号?
【问题讨论】:
-
请缩小你的文字大小,我们不需要那么多行就可以理解有
=。您使用什么代码对文本进行编码? -
如果这里不适合询问 php 问题,请建议一个合适的 sub。
-
再次对于投票关闭此问题作为离题的个人,请建议适当的子而不是默默地杀死问题。我还建议不要关闭它,因为截至本回复,标签
PHPMailer已被使用 ''2055'' 次。 -
甚至可能是本地问题和 Outlook 中的某些设置。据我所见,你有属于 的元数据和属于 的 等等。如果没有正确的 HTML 文档结构,那么肯定会抱怨。包括一个有效的文档类型。
-
@Fred-ii-,添加 html 和 body 标签有效。如果您将此添加为答案,我会适当地感谢您。