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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…