PHP Code to Extract Attachments from Mail Files CodeUnit 08 DEC 2009

PHP-logoFor a recent project I needed to parse .mai mail files to locate any Excel or Zip files that may have been sent through as attachments. The following block of code is the result of my work:

Obviously by extending the content types being searched on with a simple or statement, you can alter the script to extract just about any type of attachment, making it quite useful indeed.

It’s fast and appears to work pretty nicely, so hopefully it can be of some use to you then! :)

Related Posts:

About Craig Lotter

South African software architect and developer at Touchwork. Husband to a cupcake baker and father to two little girls. I don't have time for myself any more.