Posted by "Richard Lynch" on 01/20/06 00:38
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.
> ------- Forwarded message follows -------
> From: Geoff <firstname.lastname@example.org>
> To: email@example.com
> 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.
> ------- End of forwarded message -------
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
[Back to original message]