PHPMailer每隔75个字符插入'='等号

a c*_*der 9 php phpmailer

使用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.&nbsp; This is a test.&nbsp; This is a test.&nbsp; This is a test.&nbsp; This is a test.&nbsp; This is a test.&nbsp; This is a test.&nbsp; This is a test.&nbsp; This is a test.&nbsp; This is a test.&nbsp; This is a test.&nbsp; This is a test.&nbsp; This is a test.&nbsp; This is a test.&nbsp; </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.&nbsp; This is a test.&nbsp; This is a test.&nbsp; This i=
s a test.&nbsp; This is a test.&nbsp; This is a test.&nbsp; This is a test.=
&nbsp; This is a test.&nbsp; This is a test.&nbsp; This is a test.&nbsp; Th=
is is a test.&nbsp; This is a test.&nbsp; This is a test.&nbsp; This is a t=
est.&nbsp; This is a test.&nbsp; This is a test.&nbsp; This is a test.&nbsp;=
 </p></font>
Run Code Online (Sandbox Code Playgroud)

在Outlook中查看时出现等号.当我将相同的文本/ html发送到Gmail帐户时,不存在等号.

需要采取什么措施来消除使用Outlook的收件人的这些迷路等号?

Sus*_*age 6

我在PHPMailer中遇到了与html-emails相同的问题.我测试了不同的东西,发现:

  • 如果邮件有一个特殊的长度会出现问题 - 在我的情况下>一行中有1002个字母(当我删除了一些字母(不相关的那些)时,电子邮件是正确的)
  • 这个问题只在某些电子邮件程序中可见(例如MS Outlook,网站t-online.de;雅虎没有问题)
  • 我试过PHPMailer 5.2.7 - 5.2.14:PHPMailer> 5.2.10中存在问题(PHPMailer 5.2.7 - 5.2.10中没有问题)
  • 解决方案如'$ mail-> Encoding ="7bit";' 或'$ mail-> LE = PHP_EOL;' 没有为我工作
  • 通过isSmtp()发送电子邮件时没有问题.
  • 测试在两个不同的服务器上:服务器1包含相同的标志,服务器2不包含那些标志,但有错误的换行符 - 两个服务器上的php配置几乎相同>它似乎不是一个php问题

所以对我来说,解决方案是"拿PHPMailer 5.2.10",直到他们在更新的版本中解决问题 - 没有好的解决方案,但它对我有用,直到找到更好的一个;-)


Fun*_*ner 5

这是您的文档应该是什么样子:

<!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>标签,因为大多数电子邮件客户端会抛弃它并忽略它.

  • @Synchro [阅读OP的评论...](http://stackoverflow.com/questions/33787777/phpmailer-inserts-equal-sign-every-75th-character/33788388?noredirect=1#comment55343609_33787777).它与它有关.也要查看他们的代码以及他们尝试发送的消息. (2认同)