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

Software developer, husband and dad to two little girls. Writer behind An Exploring South African. I don't have time for myself any more.