IMAP- Parsing original headers from a bounced mail

孤街醉人 提交于 2019-12-13 11:06:23

问题


I am sending hundreds of emails with an unique id through email header. I have to track the bounced mails for the particular unique id.

I can see the bounced emails with an attached EML file in my mailbox. Unfortunately the unique ID which I am looking for is placed in the attached EML file's header instead of bounced email's header.

I am using PHP's IMAP function to read the headers and body sections. But unable to read EML attachment.

Could any one explain how to read or parse the EML attachment using IMAP function.

Thanks.


回答1:


The .eml is most properly described as a message/rfc822 bodypart; it comprises one part of a multipart/report.

In IMAP each bodypart has its own part number, and you can access headers and individual fields by supplying the number. In many bounces, the number of the message/rfc822 is 3, and you can access e.g. the subject using f uid fetch 123456 body.peek[3.1.header.fields (subject)]. The server will do the parsing you want and give you back the subject field.

The usual way to get the part number is to use bodystructure.

Expressing this using PHP is left as an exercise for the reader. Good luck.



来源:https://stackoverflow.com/questions/21936983/imap-parsing-original-headers-from-a-bounced-mail

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!