I am currently piping mail to a script that does a bit of parsing as per this article:
http://www.devarticles.com/c/a/PHP/Incoming-Mail-and-PHP/1/
Email piped to the script gets recorded as $email. The script then parses it like this:
http://www.filefarmer.com/2/bitt3n/example.html
I want to parse $email more completely. I want to isolate fully the message body and email addresses, and ideally also isolate the message from any text that comprises a message to which the message body is a reply. (Ultimately I hope to handle attachments.)
In a perfect world, some function would take $email as its argument and returns variables $to, $from, $subject, $message, $num_attachments, and $attachments_array with the array indicating the name, type, size and filepath of each attachment saved by the function (which saves each attachment to a specified directory if this attachment meets the size, type and number criteria).
Is there some library I can install that has such a function? Searching around I found some software called ripMIME that looks interesting (http://www.pldaniels.com/ripmime/), but I am not sure that is what I want and it doesn’t appear to come with any documentation. Also I’ve never needed to install a library before, and I believe I would have to get a ripMIME binary to use it, since it's written in C and needs to be compiled.
I also found http://pear.php.net/manual/en/package.mail.mail-mime.php, so that is another option I am considering.
Thanks for your help.