I need some PHP code or a class that can take a MIME or RFC822 formatted email message, and extract and return any image attachments and their corresponding filenames. Is there any code that will do this? Or can anyone give me information on how I'd code one? (Remember, I need to get access to the actual image data and encoding information, in addition to the filename.)
Thanks,
Adam Atlas
Extract attachments from MIME or 822 format messages
Moderator: General Moderators
Look at this page. I used that for a little while. The author (Richard Heyes) states that using built-in php extensions (such as mailparse or the imap functions) are faster. However, when I used his script, I didn't have control over the configuration of my server, so it worked out fine. I think that the imap functions are the best way to go, but they require an additional library. The manual covers that more. Note that, as the manual points out, the imap functions can use pop3 and nntp, not just imap. Hope that helps, good luck.