使用PHPMailer 5.2.14,电子邮件以text/html发送.传出的文本每隔75个字符散布着相同的符号.
我尝试使用EOL解决方法,但它没有删除额外的等号:
$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();
Run Code Online (Sandbox Code Playgroud)
收到后产生的来源:
<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>
Run Code Online (Sandbox Code Playgroud)
在Outlook中查看时出现等号.当我将相同的文本/ html发送到Gmail帐户时,不存在等号.
需要采取什么措施来消除使用Outlook的收件人的这些迷路等号?
我在PHPMailer中遇到了与html-emails相同的问题.我测试了不同的东西,发现:
所以对我来说,解决方案是"拿PHPMailer 5.2.10",直到他们在更新的版本中解决问题 - 没有好的解决方案,但它对我有用,直到找到更好的一个;-)
这是您的文档应该是什么样子:
<!DOCTYPE html>
<head>
meta stuff and <base href...>
</head>
<body>
HTML stuff
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
除此之外的所有内容都不符合HTML标准,将会阻碍您的工作.
我可以看到,你有meta属于<head>并且有<font>标签属于<body>等等.如果没有正确的HTML文档结构,那么肯定会抱怨.包括有效的doctype.
关于<font>标签的快速旁注; 这是在弃用.
您可以使用内联CSS样式.不要使用<style>标签,因为大多数电子邮件客户端会抛弃它并忽略它.