> It seems to me that if you looked at the raw email and found the > boundary, and focused on the only mime-types you care about, you'd > be able to hack the file pretty easily... I just may have to do that. One problem though is that many mails are encoded in some way (I mean byte-encoding, like base 64) and I was hoping to make use of the transparent decoding capability of a class or library made to do that sort of thing. But if I cannot, then yours is the approach I will probably use. > All them lawyerly crapola signatures outside the control of the > actual user implies that there is SOME kind of software available > to do it... ...but many of them are in commercial packages, or are plugins to MSExchange or similar. And most of the open-source ones only stick the footer in the first piece of text/plain that they find, without being aware of multiparts. Thanks, Geoff. On 19 Jan 2006 at 16:38, Richard Lynch wrote: > All them lawyerly crapola signatures outside the control of the actual > user implies that there is SOME kind of software available to do it... > > It seems to me that if you looked at the raw email and found the > boundary, and focused on the only mime-types you care about, you'd be > able to hack the file pretty easily... > > And if it's not mime-encoded, it's just text, and a simple fopen($x, > 'a'); fwrite($x, $sig); fclose($x); would do it. > > Maybe I'm over-simplifying something? > > > On Thu, January 19, 2006 4:22 pm, Geoff wrote: > > Nobody got any ideas on this? I would be interested to hear from > > anyone who has successfully adjusted parts of an email message while > > it is in transit, by ANY method. I'm getting desparate and will try > > anything, even if it is not 100% PHP. > > > > All ideas, suggestions greatly appreciated. > > > > Geoff. > > > > > > ------- Forwarded message follows ------- > > From: Geoff <php-general@xxxxxxx> > > To: php-general@xxxxxxxxxxxxx > > Subject: inserting text into a mime message > > Date sent: Thu, 19 Jan 2006 10:51:37 +0200 > > > > 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. > > > > ------- End of forwarded message ------- > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > Like Music? > http://l-i-e.com/artists.htm > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > !DSPAM:43d0236364872042218820! > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php