FTR, while examining some raw multipart messages from this very list, I
noted that mailman (the software used to run the list) manages to tack on
the list footer in a MIME-compatible fashion. You might want to retrieve
the code for mailman and see if you can't hack a piece of it.
The following is barely tested, and only against a very small number of
messages, but may provide for a starting place for you:
:0
* Content-Type:.*multipart.*boundary="?\/[^"]+
{
# if we matched a Content-Type of multipart with a boundary marker
# identified, then use that to tack our message on
# note that the echo *I* use is known to support some character
# escapes -- yours may not, and if that is the case, you'll have a
# series of echos.
:0bf
| cat - ; echo -e "--$MATCH\nMIME-version: 1.0\nContent-Type: text/plain;
charset=us-ascii\nContent-transfer-encoding: 7BIT\nContent-disposition:
inline\n--$MATCH--\n" ; cat somefile
}
# no multipart / boundary - just slap the basic text in there and we're done.
:0Ebf
| cat - somefile
Note that this will merely insert a blob of plaintext - if the message
itself is HTML, this isn't going to successfully insert itself within the
HTML portion, and most clients I've used will NOT view the text portion
inline with the HTML portion.
If a boundary marker is trailed by a couple of hyphens, most clients will
view that as the final boundary marker, failing to parse further boundaries
in the message. Thus, it would be markedly easier to PREFIX the message
with this simplistic technique than to reliably append a footer (which
would require stripping that existing terminating boundary marker, or
otherwise controlling insertion BEFORE it). To insert the text as a prefix
to the existing text, change the order of the cat and echo operations, plus
omit the boundary terminator AFTER the prefix text (since the message
should already have a boundary at the top of the body).
---
Sean B. Straw / Professional Software Engineering
Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
Please DO NOT carbon me on list replies. I'll get my copy from the list.
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail