我正在研究一个解析电子邮件收件箱的脚本。如何判断消息部分是附件还是嵌入图像?此示例邮件是由一位用户发送的,他告诉我他的客户嵌入了图像,但 disposition="Attachment" 看起来像附加图像,我看到 AppleMail 使用“内联”,这似乎更合理......
我还检查了 msg-text 以查看它是否引用了附加的文件,但在这个示例中也没有对文件的引用——但用户坚持认为它们是嵌入的,而不是附加的。
消息结构:
object(stdClass)#218 (12) {
["type"]=>
int(1)
["encoding"]=>
int(0)
["ifsubtype"]=>
int(1)
["subtype"]=>
string(5) "MIXED"
["ifdescription"]=>
int(0)
["ifid"]=>
int(0)
["bytes"]=>
int(262312)
["ifdisposition"]=>
int(0)
["ifdparameters"]=>
int(0)
["ifparameters"]=>
int(1)
["parameters"]=>
array(1) {
[0]=>
object(stdClass)#219 (2) {
["attribute"]=>
string(8) "BOUNDARY"
["value"]=>
string(37) "----_=_NextPart_001_01CE168A.AE40BD2E"
}
}
["parts"]=>
array(5) {
[0]=>
object(stdClass)#220 (12) {
["type"]=>
int(1)
["encoding"]=>
int(0)
["ifsubtype"]=>
int(1)
["subtype"]=>
string(11) "ALTERNATIVE"
["ifdescription"]=>
int(0)
["ifid"]=>
int(0)
["bytes"]=>
int(4237)
["ifdisposition"]=>
int(0)
["ifdparameters"]=>
int(0)
["ifparameters"]=>
int(1)
["parameters"]=>
array(1) {
[0]=>
object(stdClass)#221 (2) {
["attribute"]=>
string(8) "BOUNDARY"
["value"]=>
string(37) "----_=_NextPart_002_01CE168A.AE40BD2E"
}
}
["parts"]=>
array(2) {
[0]=>
object(stdClass)#222 (12) {
["type"]=>
int(0)
["encoding"]=>
int(4)
["ifsubtype"]=>
int(1)
["subtype"]=>
string(5) "PLAIN"
["ifdescription"]=>
int(0)
["ifid"]=>
int(0)
["lines"]=>
int(21)
["bytes"]=>
int(204)
["ifdisposition"]=>
int(0)
["ifdparameters"]=>
int(0)
["ifparameters"]=>
int(1)
["parameters"]=>
array(1) {
[0]=>
object(stdClass)#223 (2) {
["attribute"]=>
string(7) "CHARSET"
["value"]=>
string(10) "iso-8859-1"
}
}
}
[1]=>
object(stdClass)#224 (12) {
["type"]=>
int(0)
["encoding"]=>
int(4)
["ifsubtype"]=>
int(1)
["subtype"]=>
string(4) "HTML"
["ifdescription"]=>
int(0)
["ifid"]=>
int(0)
["lines"]=>
int(97)
["bytes"]=>
int(3709)
["ifdisposition"]=>
int(0)
["ifdparameters"]=>
int(0)
["ifparameters"]=>
int(1)
["parameters"]=>
array(1) {
[0]=>
object(stdClass)#225 (2) {
["attribute"]=>
string(7) "CHARSET"
["value"]=>
string(10) "iso-8859-1"
}
}
}
}
}
[1]=>
object(stdClass)#226 (14) {
["type"]=>
int(5)
["encoding"]=>
int(3)
["ifsubtype"]=>
int(1)
["subtype"]=>
string(3) "BMP"
["ifdescription"]=>
int(1)
["description"]=>
string(7) "bmp.bmp"
["ifid"]=>
int(0)
["bytes"]=>
int(191348)
["ifdisposition"]=>
int(1)
["disposition"]=>
string(10) "ATTACHMENT"
["ifdparameters"]=>
int(1)
["dparameters"]=>
array(1) {
[0]=>
object(stdClass)#227 (2) {
["attribute"]=>
string(8) "FILENAME"
["value"]=>
string(7) "bmp.bmp"
}
}
["ifparameters"]=>
int(1)
["parameters"]=>
array(1) {
[0]=>
object(stdClass)#228 (2) {
["attribute"]=>
string(4) "NAME"
["value"]=>
string(7) "bmp.bmp"
}
}
}
[2]=>
object(stdClass)#229 (14) {
["type"]=>
int(5)
["encoding"]=>
int(3)
["ifsubtype"]=>
int(1)
["subtype"]=>
string(3) "GIF"
["ifdescription"]=>
int(1)
["description"]=>
string(7) "gif.gif"
["ifid"]=>
int(0)
["bytes"]=>
int(12178)
["ifdisposition"]=>
int(1)
["disposition"]=>
string(10) "ATTACHMENT"
["ifdparameters"]=>
int(1)
["dparameters"]=>
array(1) {
[0]=>
object(stdClass)#230 (2) {
["attribute"]=>
string(8) "FILENAME"
["value"]=>
string(7) "gif.gif"
}
}
["ifparameters"]=>
int(1)
["parameters"]=>
array(1) {
[0]=>
object(stdClass)#231 (2) {
["attribute"]=>
string(4) "NAME"
["value"]=>
string(7) "gif.gif"
}
}
}
[3]=>
object(stdClass)#232 (14) {
["type"]=>
int(5)
["encoding"]=>
int(3)
["ifsubtype"]=>
int(1)
["subtype"]=>
string(4) "JPEG"
["ifdescription"]=>
int(1)
["description"]=>
string(7) "jpg.jpg"
["ifid"]=>
int(0)
["bytes"]=>
int(25642)
["ifdisposition"]=>
int(1)
["disposition"]=>
string(10) "ATTACHMENT"
["ifdparameters"]=>
int(1)
["dparameters"]=>
array(1) {
[0]=>
object(stdClass)#233 (2) {
["attribute"]=>
string(8) "FILENAME"
["value"]=>
string(7) "jpg.jpg"
}
}
["ifparameters"]=>
int(1)
["parameters"]=>
array(1) {
[0]=>
object(stdClass)#234 (2) {
["attribute"]=>
string(4) "NAME"
["value"]=>
string(7) "jpg.jpg"
}
}
}
[4]=>
object(stdClass)#235 (14) {
["type"]=>
int(3)
["encoding"]=>
int(3)
["ifsubtype"]=>
int(1)
["subtype"]=>
string(12) "OCTET-STREAM"
["ifdescription"]=>
int(1)
["description"]=>
string(7) "pdf.pdf"
["ifid"]=>
int(0)
["bytes"]=>
int(27834)
["ifdisposition"]=>
int(1)
["disposition"]=>
string(10) "ATTACHMENT"
["ifdparameters"]=>
int(1)
["dparameters"]=>
array(1) {
[0]=>
object(stdClass)#236 (2) {
["attribute"]=>
string(8) "FILENAME"
["value"]=>
string(7) "pdf.pdf"
}
}
["ifparameters"]=>
int(1)
["parameters"]=>
array(1) {
[0]=>
object(stdClass)#237 (2) {
["attribute"]=>
string(4) "NAME"
["value"]=>
string(7) "pdf.pdf"
}
}
}
}
}