使用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为收件人消除这些迷路等号需要做些什么?
答案 0 :(得分:6)
我在PHPMailer中遇到了与html-emails相同的问题。我测试过不同的东西并发现:
所以对我来说,解决方案是#34;采用PHPMailer 5.2.10&#34;直到他们在更新的版本中解决问题 - 没有好的解决方案,但它对我有用,直到找到更好的一个; - )
答案 1 :(得分:5)
这是您的文档应该是什么样的:
<!DOCTYPE html>
<head>
meta stuff and <base href...>
</head>
<body>
HTML stuff
</body>
</html>
除此之外的所有内容都不符合HTML,会对你的一天产生影响。
我可以看到,您的meta属于<head>
并且<font>
标签属于<body>
等。如果没有正确的HTML文档结构化,那么肯定会抱怨。包括有效的doctype。
关于<font>
标签的快速旁注;它已被弃用。
您可以使用内联CSS样式。不要使用<style>
标签,因为大多数电子邮件客户端会将其丢弃并忽略它。
答案 2 :(得分:3)
这称为quoted-printable encoding,在电子邮件中非常常见。等号用作转义字符,行长度限制为76个字符。如果Outlook无法识别这一点,您可能必须手动设置标题,告诉它以这种方式编码。
答案 3 :(得分:0)
使用'$mail->Encoding = 'base64';
它现在适用于v5.2.17。
希望这最终在v6中得到修复。
答案 4 :(得分:0)
通过添加$ email-> crlf =“ \ r \ n”; 您可以解决此问题。
答案 5 :(得分:0)
我正在使用phpMailer 5.2.25并通过SendPulse网关发送。直接通过我的ISP使用SMTP没问题,但是恰好在一行的75个字符之后看到了'='符号-因此它与行长换行有关。设置$ mail-> Encoding ='base64';按照asdfklgash的回答,防止插入等号(已通过A / B比较证明)。
答案 6 :(得分:-1)
$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.&`enter code here`nbsp; This is a test. This is a test. This is a test. </p>";
// fix EOL here?
$email->LE = PHP_EOL;
$email->Send();