我正在使用python的IMAPClient
从IMAP服务器检索电子邮件。我检索的其中一个属性是BODYSTRUCTURE
。但是,我找不到任何有关如何解释返回值的文档。这是IMAP服务器返回的主体结构
16:12.679978 < FLAGS (NotJunk $NotJunk \Seen) BODYSTRUCTURE ((("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "QUOTED-PRINTABLE" 4888 170 NIL NIL NIL)("TEXT" "HTML" ("CHARSET" "us-ascii") NIL NIL "QUOTED-PRINTABLE" 32407 479 NIL NIL NIL) "ALTERNATIVE" ("BOUNDARY" "Apple-Mail=_3AAA7CD7-3B07-406A-83CB-2C7762C3306E") NIL NIL)("APPLICATION" "PKCS7-SIGNATURE" ("NAME" "smime.p7s") NIL NIL "BASE64" 2414 NIL ("ATTACHMENT" ("FILENAME" "smime.p7s")) NIL) "SIGNED" ("BOUNDARY" "Apple-Mail=_DF4FE6BB-F796-46D7-A593-9723F4315DD2" "MICALG" "sha1" "PROTOCOL" "application/pkcs7-signature") NIL NIL))
这是解析为python类型的相同主体结构。
"BODYSTRUCTURE": [
[
[
[
"TEXT",
"PLAIN",
[
"CHARSET",
"us-ascii"
],
null,
null,
"QUOTED-PRINTABLE",
4888,
170,
null,
null,
null
],
[
"TEXT",
"HTML",
[
"CHARSET",
"us-ascii"
],
null,
null,
"QUOTED-PRINTABLE",
32407,
479,
null,
null,
null
],
"ALTERNATIVE",
[
"BOUNDARY",
"Apple-Mail=_3AAA7CD7-3B07-406A-83CB-2C7762C3306E"
],
null,
null
],
[
"APPLICATION",
"PKCS7-SIGNATURE",
[
"NAME",
"smime.p7s"
],
null,
null,
"BASE64",
2414,
null,
[
"ATTACHMENT",
[
"FILENAME",
"smime.p7s"
]
],
null
]
],
"SIGNED",
[
"BOUNDARY",
"Apple-Mail=_DF4FE6BB-F796-46D7-A593-9723F4315DD2",
"MICALG",
"sha1",
"PROTOCOL",
"application/pkcs7-signature"
],
null,
null
],
数组似乎不是恒定长度。数组的每个元素代表什么?