procmail
[Top] [All Lists]

RE: Converting HTML to plain text

2001-03-29 11:54:42
Thanks for the recipe - I don't have metamail, I'm afraid.

Any other solutions for this one please?

David

-----Original Message-----
From: procmail-admin(_at_)lists(_dot_)rwth-aachen(_dot_)de
[mailto:procmail-admin(_at_)lists(_dot_)rwth-aachen(_dot_)de]On Behalf Of 
Timothy J.
Luoma
Sent: 27 March 2001 14:28
To: David Cross; procmail-users(_at_)procmail(_dot_)org
Subject: RE: Converting HTML to plain text



I need a recipe providing a good solution to the HTML>plain text problem.

1) If I do have lynx
2) If I don't

metamail is probably a better solution than lynx... my use of metamail is
not
for general delivery, so I'll let someone else post something tested rather
than
my untested recipe.

One thing that I found when I was trying to use sed was that if I modified
the
body of the email, I needed to make sure that I removed the MIME headers so
my
mailer (Outlook) didn't get confused.

I've found that most of the basic HTML mail that I get (ie email that for
all
intents and purposes should have been plain text but wasn't, probably
because
the program defaults to HTML) comes from people who use AOL (especially 6.0
which defaulted to HTML) or Outlook (Express).

These 3 recipes work well for me and might for you.  I should also say that
the
first recipe in my .procmailrc backs up the original, unmodified email, so
if
any of my recipes crap out on me, I won't have lost the message.  That gives
me
the freedom to go a little more risky in my recipe writing.


Note that these recipes attach a little footer at the bottom of the message
to
tell me that the messages have been altered.  You can remove the 'sed -e "$
a\\
\\
{whatever}\\' if you do not wish to have this happen.

:0fbw
* ^Content-Type: multipart/mixed
* ^X-Mailer: AOL 6.0
|metamail 2>/dev/null | sed -e "$ a\\
\\
{AOL mixed}\\
"

############################################################################
####
#######################################################

# David T. will be happy to see a *useful* use of nesting in this case ;-)

:0
* ^Content-Type: multipart/alternative
{
        :0fbw
        * ^From:(_dot_)*(_at_)aol\(_dot_)com
        |sed -e "$ a\\
\\
{AOL alt}\\
" -e '1,/Content-Transfer-Encoding: /d; /--part/,$d; s/=A0//'

                :0afhw
                |formail -i"MIME-Version:" -i"Content-Disposition:" 
-i"Content-Type:"



############################################################################
####
############################
        :0fbw
        * ^X-Mailer: Microsoft Outlook
        |sed -e "$ a\\
\\
{MS alt}\\
" -e '1,/Content-Transfer-Encoding: /d; /------=_NextPart_/,$d; s/=$//g;
s/=20//g'

                :0afhw
                |formail -i"MIME-Version:" -i"Content-Disposition:" 
-i"Content-Type:"
}
############################################################################
####
#######################################################

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail