关于此任务
下表定义了 mimeheader 输入参数中的元素:
表 1. 元素名称 |
缺省值 |
mimeVersion |
当前未使用。 |
contentType/mainType |
当前未使用。读取 MIME 活动通过使用指定的边界定界符对消息进行语法分析来确定消息是否是多部分的 |
contentType/subType |
当前未使用。 |
contentType/charset |
当前未使用。 |
contentType/attribute/name - contentType/attribute/value |
attribute 元素包含名称/值对形式的属性集。您可以指定 boundary 元素,该元素用于指定消息的多部分实体之间的边界定界符。如果指定 boundary 属性,那么它会覆盖消息本身中设置的缺省边界。
如果在消息本身中未指定 boundary 属性或者使用的是 attribute 元素,那么在运行时期间会抛出异常。 |
contentTransferEncoding |
当前未使用。 |
otherMimeHeaders |
当前未使用。 |
消息体可包含以 mimeheader 输入参数的
contentType/attribute 元素中指定的边界值分隔的一个或多个 MIME 部分。各部分包含描述关联部分主体的各种属性的 MIME 头。个别部分的语法分析方式取决于实体主体的 entityMimeHeader 中以下参数的赋值:
- Content-Type 头
- Content-Type 头中的 Charset 属性
- Content-Transfer-Encoding
该部分主体的语法分析方式取决于 Content-Transfer-Encoding 和 Content-Type 的设置:
Content-Type 等于“text”:
- 如果 Content-Type 为“text”并且 Content-Transfer-Encoding 为“7-bit”/”8-bit”或“binary”,那么该部分主体会转换为 UTF8 编码字符串并复制到 parts 输出参数的 entityBody 元素中。
- 如果 Content-Type 为“text”并且 Content-Transfer-Encoding 为“quoted-printable”,那么该部分主体会进行 quoted-printable 解码,基于 charset 属性转换为 UTF8 编码字符串并复制到 parts 输出参数的 entityBody 元素中。
- 如果 Content-Type 为“text”并且 Content-Transfer-Encoding 为“base64”,那么该部分主体会进行 base64 解码,基于 charset 属性转换为 UTF8 编码字符串并复制到 parts 输出参数的 entityBody 元素中。
如果未在 MIME 头部分中显式指定,那么字符集缺省为 UTF8。仅当 Content-Disposition 等于“attachment”并且 Content-Type 等于“text”时,此缺省行为才会出现异常。在此情况下,不会将该部分视为文本,因为无法获知数据的字符集。此外,Content-Transfer-Encoding 会设置为“binary”。
Content-Type 不等于“text”:
- 如果 Content-Type 不等于“text”并且 Content-Transfer-Encoding 为“7bit”/“8bit”或“binary”,那么该部分主体会转换为 UTF8 编码字符串并复制到 parts 输出参数的 entityBody 元素中。
- 如果 Content-Type 不等于“text”并且 Content-Transfer-Encoding 为“quoted-printable”,那么该部分主体会进行 quoted-printable 解码,base64 编码并复制到 parts 输出参数的 entityBody 元素中。
- 如果 Content-Type 不等于“text”并且 Content-Transfer-Encoding 为“base64”,那么该部分主体会按原样(base64 数据)复制到 parts 输出参数的 entityBody 元素中。