procmail
[Top] [All Lists]

Re: convert a HTML multipart message to a plain Text formated Message

2006-10-14 13:50:10
On 10/14/06, Matthias Häker <mhaeker(_at_)its-h(_dot_)de> wrote:

don't beliver thats going to be so difficult
even simple mail Clients can be configured show only
the TEXT part. ???????

*Showing* only the text part is one thing.  Taking the message
structure apart and putting it back together again with the HTML part
discarded and/or converted to text is an entirely different thing.  If
all you want to do is show the text part you don't need to understand
the structure in very much detail.

For example, to handle multiparts by discarding all but the text part,
download http://www.well.com/user/barts/email/mimepart.txt and:

------
INCLUDERC=mimepart.txt
:0
* BODY_PART ?? .
{
 :0fh
 | formail -i"Content-Type: text/plain" -i"Content-Disposition:"

 :0fbi
 | echo "$BODY_PART"
}
------

I suspect from your remark about demime, though, that in the event
that there are more than two parts you want to preserve more of the
structure.  In that case you need a tool that will disassemble and
re-assemble MIME content.  I don't know of anything that is
specialized for the case you want -- you may have to do some of your
own programming, e.g.,  get the perl MIME-tools and write something
based on the MIME::Parser class.


____________________________________________________________
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