Hi,
It hit me too that poeple are sending those ugly 7k mime attachements
when their MUA is MS internet explorer. It spits out MIME messages in
attached format. I can read MIME okay, but I have no use for the
ms-tnef
I wanted to get rid of the base64 block, while still preserving the MIME,
so I wrote this awk script. I know that here are couple SED
wizards like [phil, david] in this list; so does anyone have any other
alternatives to do the same more effifiently than as done with awk now.
I might even consider killing the MIME tags (MIME headers too)
entirely leaving in only the message, but before that I must know
that there is only
MESSAGE
ms-tnef
and not
MESSAGE
attachement << 1 or more
ms-tnef
Might scoring help here to find out the case a) and b)?
jari
# Idiot MS Explorer adds application/ms-tnef 7k tag to the message
# Do not break the mime message, but only squeeze out the 7k
# block and rewrite it like this
#
# ------ =_NextPart_000_01BD04D4.A5AC6B00
# Content-Type: text/plain;
#
# ------ =_NextPart_000_01BD04D4.A5AC6B
#
# - raise suppress flag(f) if we find ms-tnef. Also change the
# mime type.
# - set flag back to 0 when the ending tag is found
# - print the lines when flag is 0.
#
:0 fb
* B ?? application/ms-tnef
| awk ' /application.ms-tnef/ \
{f=1; print "Content-Type: text/plain;\n"} \
/------/ \
{f=0} \
{if (f==0) {print} } '
Subject: test
<other headers>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="---- =_NextPart_000_01BD04D4.A5AC6B00"
------ =_NextPart_000_01BD04D4.A5AC6B00
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<the message itself>
------ =_NextPart_000_01BD04D4.A5AC6B00
Content-Type: application/ms-tnef
Content-Transfer-Encoding: base64
eJ8+IjsQAQaQCAAEAAAAAAABAAEAAQeQBgAIAAAA5AQAAAAAAADoAAEIgAcAGAAAAElQTS5NaWNy
<and the rest of 7k block>
------ =_NextPart_000_01BD04D4.A5AC6B00--