procmail
[Top] [All Lists]

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

2006-10-15 02:42:35
On Sat, Oct 14, 2006 at 01:38:26PM -0700, Bart Schaefer wrote:

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:

Very good encapsulation of the problem, Bart.  Also, naturally,
your procmail-based solution (though snipped here) is a nice bit of
work.

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.

Actually, the reformime program that he already has been playing with
can do that very thing.  It can also rewrite the MIME and Content-Type
headers as needed to reflect the new structure.  Given what Matthias
seems to want to do, I'd suggest to him to look deeper still at
reformime.

Dallman

____________________________________________________________
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