MIME邮件未在Mac电子邮件客户端中正确显示

时间:2014-06-25 14:56:32

标签: mime-types mime email-client mime-message mime-mail

我正在从代码生成多部分的mime电子邮件。我正在使用的mime格式的示例如下所示。这在大多数电子邮件客户端中显示得很好,但在Mac上的Apple电子邮件中,消息只是说"此消息没有内容"。任何人都可以解释为什么Mac上的Mail无法显示下面的消息?

非常感谢。

X-SYSTEM-Source: 0BC1ACEB-5527-42BF-A618-814EBB750F59
x-virtual-mta: zzzstandardmta
MIME-Version: 1.0
From: ScanTest <ScanTest@xxxxxx.com>
To: Jane Doe <janedoe@zzzzzz.com>
Date: 25 Jun 2014 15:42:26 +0100
Subject: Generic ScanTest Email
Content-Type: multipart/mixed; boundary=--mainboundary_67d1fe5e-6a7f-4c46-818d-9a33a6abddf1
Message-ID: <199999-19999908ies800000016@webserver.vvvvvvvvv.co.uk>
X-OriginalArrivalTime: 25 Jun 2014 14:42:26.0632 (UTC) FILETIME=[AEE3E480:01CF9083]
X-Original-To: janedoe@zzzzzz.com
X-Virus-Scanned: ClamAV using ClamSMTP


----mainboundary_67d1fe5e-6a7f-4c46-818d-9a33a6abddf1
Content-Type: multipart/alternative; boundary=--altboundary_67d1fe5e-6a7f-4c46-818d-9a33a6abddf1


----altboundary_67d1fe5e-6a7f-4c46-818d-9a33a6abddf1
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit


This is ScanTest from 

Dear Jane<br /><br />This is a test email.  Does it look ok?<br /><br />Here is some more blurb. One of the things about this text is that it is not in Latin. Here is some more blurb. One of the things about this text is that it is not in Latin. Here is some more blurb. One of the things about this text is that it is not in Latin. Here is some more blurb. One of the things about this text is that it is not in Latin.<br />Here is some more blurb. One of the things about this text is that it is not in Latin.<br />Here is some more blurb. One of the things about this text is that it is not in Latin<br /><br />Here is some more blurb. One of the things about this text is that it is not in Latin<br />Here is some more blurb. One of the things about this text is that it is not in Latin<br />Here is some more blurb. One of the things about this text is that it is not in Latin



Thanks from the team

----altboundary_67d1fe5e-6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lIG9mIHRoZSB0aGluZ3MgYWJvdXQgdGhpcyB0ZXh0IGlzIHRoYXQgaXQgaXMgbm90IGluIExhdGluLjxiciAvPkhlcmUgaXMgc29tZSBtb3JlIGJsdXJiLiBPbmUgb2YgdGhlIHRoaW5ncyBhYm91dCB0aGlzIHRleHQgaXMgdGhhdCBpdCBpcyBub3QgaW4gTGF0aW48YnIgLz48YnIgLz5IZXJlIGlzIHNvbWUgbW9yZSBibHVyYi4gT25lIG9mIHRoZSB0aGluZ3MgYWJvdXQgdGhpcyB0ZXh0IGlzIHRoYXQgaXQgaXMgbm90IGluIExhdGluPGJyIC8+SGVyZSBpcyBzb21lIG1vcmUgYmx1cmIuIE9uZSBvZiB0aGUgdGhpbmdzIGFib3V0IHRoaXMgdGV4dCBpcyB0aGF0IGl0IGlzIG5vdCBpbiBMYXRpbjxiciAvPkhlcmUgaXMgc29tZSBtb3JlIGJsdXJiLiBPbmUgb2YgdGhlIHRoaW5ncyBhYm91dCB0aGlzIHRleHQgaXMgdGhhdCBpdCBpcyBub3QgaW4gTGF0aW48L3A+DQoNCiAgICAgICAgICAgICAgICA8cD48L3A+DQoNCiAgICAgICAgICAgICAgICA8cD5UaGFua3MgZnJvbSB0aGUgdGVhbTwvcD4NCiAgICAgICAgICAgIA0KICAgICAgICAgICAgICAgIDxociB3aWR0aD0iOTYlIiAvPg0KICAgICAgICAgICAgICAgIA0KICAgICAgICAgICAgICAgIA0KICAgICAgICAgICAgICAgIAk8YnIgLz4NCiAgICAgICAgICAgICAgICANCg0KDQogICAgICAgICAgICA8L3RkPg0KICAgICAgICA8L3RyPg0KICAgIDwvdGFibGU+DQo8L2JvZHk+DQo8L2h0bWw+

----altboundary_67d1fe5e-6a7f-4c46-818d-9a33a6abddf1--

----mainboundary_67d1fe5e-6a7f-4c46-818d-9a33a6abddf1--

1 个答案:

答案 0 :(得分:0)

Base64编码的数据在一行中超过4000个字符。这需要分成更短的行。这是RFC5322 "Internet Message Format"关于行长度的说法:

  

2.1.1。行长限制

     

此规范对一行中的字符数有两个限制。 每行字符不得超过998个字符,且不应超过78个字符,不包括CRLF。

     

998字符限制是由于发送,接收或存储IMF消息的许多实现中的限制,这些消息在一行上无法处理超过998个字符。为了鲁棒性,接收实现可以很好地处理一行中任意大量的字符。但是,有太多的实现(符合[RFC5321]的传输要求)不接受包含超过1000个字符的消息,包括CR和LF 每行,对于不创建此类消息的实现非常重要。

此外,请确保终止标题和周围分隔符的行结尾实际上是CRLF,并且它们严格遵循RFC 2046 "MIME Part Two: Media Types"中描述的MIME语法。摘录(BNF语法,有点简化):

multipart-body := [preamble CRLF]
                  dash-boundary CRLF
                  body-part *encapsulation
                  close-delimiter
                  [CRLF epilogue]

dash-boundary := "--" boundary

body-part := MIME-part-headers [CRLF *OCTET]

encapsulation := delimiter
                 CRLF body-part

delimiter := CRLF dash-boundary

close-delimiter := delimiter "--"