Hi All, I've been searching the archives for help on this, but have come up empty-handed. Here's the thing: I'm using a PHP script to parse every message coming through a mailserver. The server invokes my script for each message, giving it a filename containing the full raw text of the email. The script needs to modify the raw message file, inserting a footer (some trailing text, eg: a disclaimer) at the end of each part of readable message. It doesn't touch file attachments, but it needs to insert the footer in any plaintext, HTML text or both (if they exist). There are so many different mime options and encoding types that it seemed like re-inventing the wheel to try working with only the raw message text, so instead I decided to use the PEAR Mail_mimeDecode module, which returns a very nice object array of all the parts, decoded and ready for use. It's no problem going through this and inserting the footer wherever it is needed. That much I've done. My problem is trying to rebuild that object array (the output of the Mail_mimeDecode::decode() function) back into its raw form once again, so that I can write the modified raw text back to the message file and the email can go on its way. Another complication is that except for the insertion of the footer, I cannot modify the original message. All the headers, dates, receive-paths, etc, must remain unchanged. Has anybody ever done anything like this before - re-encoding a message that had been decoded by Mail_mimeDecode::decode()? I've looked at the encode() function, but it seems to be used for making a simple message from scratch (with just one body part), it is not really the opposite of decode(). [I may be wrong about this - there are no examples in the PEAR manual]. I'm not hung up about what to use, it doesn't have to be PEAR, I will use any library or code that will do the job. Alternatively, if it is possible to do this with encode(), I would love to see an example, as I couldn't get it to work that way myself. Many thanks. Geoff. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php