drvxclagw656708070
drvxclagw656708070
2014-07-29 09:57
浏览 839
已采纳

Outlook显示电子邮件html,好像它是纯文本,太多换行符

I can generate emails in php and send them so that they are correctly shown as html in Gmail and Apple mail and other client. I also do not get any formatting errors from spam assassin.

However, one receiver using Outlook 14 on Mac OS X receives the emails as though the html part were plain text. The same thing happens if I disable spam assassin on his hosting account. Here is the source of such an email when it is received by the user (edited to remove domain names and email addresses and shorten the message body):

Return-path: <_www@[domain].com>
Envelope-to: info@[domain].com
Delivery-date: Tue, 29 Jul 2014 01:39:03 -0700
Received: from [domain].com ([212.85.69.251]:50283)
by biz61.inmotionhosting.com with esmtp (Exim 4.82)
(envelope-from <_www@[domain].com>)
id 1XC2w3-0003s4-C7
for info@[domain].com; Tue, 29 Jul 2014 01:39:03 -0700
Received: by [domain].com (Postfix, from userid 70)
id 693E248D80BC; Tue, 29 Jul 2014 10:39:02 +0200 (CEST)
To: info@[domain].com
Subject: test2 - ignore - Link
From: Action Sports <noreply@[domain].com>
Reply-to: [my-email]@[domain].com
Cc: [my-email]@[domain].com
Sender: info@[domain].com
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary=c4d5d00c4725d9ed0b3c8b
Message-Id: <20140729083902.693E248D80BC@[domain].com>
Date: Tue, 29 Jul 2014 10:39:02 +0200 (CEST)

--c4d5d00c4725d9ed0b3c8b

Content-type: text/plain; charset=utf-8


testing - ignore





--c4d5d00c4725d9ed0b3c8b

Content-type: text/html; charset=utf-8



<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style TYPE="text/css">
<!--
table{
border-collapse:collapse;
border:1px solid #888;
}

table td, table th{
border:1px solid #888;
padding:3px;
}
-->
</style></head>
<body>

testing - ignore 
<br>



</body>
</html>



--c4d5d00c4725d9ed0b3c8b--

Here is what Outlook displays as the human readable content of the mail when opened normally in a new window:

[ at the top is the normal outlook header, followed by the following blank line: ]

Content-type: text/html; charset=utf-8



<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style TYPE="text/css">
<!--
table{
border-collapse:collapse;
border:1px solid #888;
}

table td, table th{
border:1px solid #888;
padding:3px;
}
-->
</style></head>
<body>

testing - ignore
<br>


</body>
</html>



[the message ends with about 4 empty lines]

If I send the same email to my Gmail account, it looks ok and has less empty lines if I view the source.

I now believe the extra empty lines are causing outlook to misunderstand that the last part is supposed to be displayed as HTML. What is causing the extra empty lines?

Am I supposed to use line breaks in the header but line breaks in the message body?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • douzhu5900
    douzhu5900 2014-07-29 10:41
    已采纳

    After testing it turns out that if I use , i.e., the standard line break according to the RFC, for the header as before but change to using only , i.e., the non-standard line break for the message body including the multipart/alternative boundary and the multipart content-type rows it works in Googlemail and a bunch of other clients tested, and even in Outlook 14 for OS X.

    点赞 评论
  • dqqxkq4047
    dqqxkq4047 2014-07-29 10:16

    According to the protocol, CRLF is used as line termination.

    Now, I could have sworn that folding was also a requirement, but from the RFC 822 spec, I don't get a specific requirement for that, but it does mention

    "Long" is commonly interpreted to mean greater than 65 or 72 characters.

    and your first line of HTML is 81 characters.

    Everything else looks fine to me.

    点赞 评论

相关推荐