我正在从代码生成多部分mime电子邮件消息。下面是我使用的mime格式的一个示例。这在大多数电子邮件客户端中显示得很好,但在Mac上的Apple email中,则显示"此消息没有内容"。谁能解释一下为什么Mac上的邮件不能显示下面的信息?
非常感谢。
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-6a7f-4c46-818d-9a33a6abddf1
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: base64
PCFET0NUWVBFIGh0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GluLjxiciAvPkhlcmUgaXMgc29tZSBtb3JlIGJsdXJiLiBPbmUgb2YgdGhlIHRoaW5ncyBhYm91dCB0aGlzIHRleHQgaXMgdGhhdCBpdCBpcyBub3QgaW4gTGF0aW48YnIgLz48YnIgLz5IZXJlIGlzIHNvbWUgbW9yZSBibHVyYi4gT25lIG9mIHRoZSB0aGluZ3MgYWJvdXQgdGhpcyB0ZXh0IGlzIHRoYXQgaXQgaXMgbm90IGluIExhdGluPGJyIC8+SGVyZSBpcyBzb21lIG1vcmUgYmx1cmIuIE9uZSBvZiB0aGUgdGhpbmdzIGFib3V0IHRoaXMgdGV4dCBpcyB0aGF0IGl0IGlzIG5vdCBpbiBMYXRpbjxiciAvPkhlcmUgaXMgc29tZSBtb3JlIGJsdXJiLiBPbmUgb2YgdGhlIHRoaW5ncyBhYm91dCB0aGlzIHRleHQgaXMgdGhhdCBpdCBpcyBub3QgaW4gTGF0aW48L3A+DQoNCiAgICAgICAgICAgICAgICA8cD48L3A+DQoNCiAgICAgICAgICAgICAgICA8cD5UaGFua3MgZnJvbSB0aGUgdGVhbTwvcD4NCiAgICAgICAgICAgIA0KICAgICAgICAgICAgICAgIDxociB3aWR0aD0iOTYlIiAvPg0KICAgICAgICAgICAgICAgIA0KICAgICAgICAgICAgICAgIA0KICAgICAgICAgICAgICAgIAk8YnIgLz4NCiAgICAgICAgICAgICAgICANCg0KDQogICAgICAgICAgICA8L3RkPg0KICAgICAgICA8L3RyPg0KICAgIDwvdGFibGU+DQo8L2JvZHk+DQo8L2h0bWw+
----altboundary_67d1fe5e-6a7f-4c46-818d-9a33a6abddf1--
----mainboundary_67d1fe5e-6a7f-4c46-818d-9a33a6abddf1--
base64编码的数据在单行上超过4000个字符。这需要分成更短的队伍。这就是RFC5322"Internet Message format"必须说明行长度:
2.1.1。
该规范对每行中的字符数有两个限制。每行字符必须不超过998个字符,不超过78个字符,不包括CRLF。
998个字符的限制是由于许多实现的限制,发送,接收或存储IMF消息,根本不能处理超过998个字符在一行。接收实现可以很好地处理一行中任意数量的字符,以保证健壮性。然而,有如此多的实现(符合[RFC5321]的传输要求)不接受包含每行CR和LF的超过1000个字符的消息,重要的是实现不创建这样的消息。
另外,确保结束头和周围分隔符的行结束符实际上是CRLF
,并且它们严格遵循RFC 2046"MIME Part Two: Media types"中描述的MIME语法。节选(BNF语法,稍微简化):