nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] Discard (trash) redundant HTML part

2008-04-24 07:58:20
On 4/23/2008 3:05 PM, Xavier Maillard wrote:
Do you know any easy way to just trash redundant HTML part of emails from 
gmail.com (for example) ?

Is there any way to extend this to a more "general" way to delete unwanted MIME 
parts ?

When I used to have more free time :-/ I'd use a script named "mhedit" that would open my favorite text editor (which, for political reasons, I won't name :) on the entire message. Because I'm comfortable with the format of MIME messages, it was easy to spot the parts I wanted to remove and to change the header accordingly.

For instance, some Microsoft email program(s) used to send multipart/alternative messages with a text/html part that had <DIV> and <FONT> tags around every line of every paragraph. Since I didn't need an HTML approximation of the plain-text message, I'd remove the text/html body part and change the Content-Type: header field from multipart/alternative to something like text/plain.

In case you need to read more about MIME message structure, Chapter 3 of the online book, http://rand-mh.sourceforge.net/book/overall/ch-itm.html , has information that's not completely up-to-date (it was written ten years ago) but which should get you started.

The script I used has two names, showv and mhedit:

$ ls -l mhedit showv
lrwxrwxrwx  1 root   jpeek    5 Apr 30  2005 mhedit -> showv
-rwxrwxr-x  1 jpeek  jpeek  337 Mar 20  1998 showv

Here's the script.

Jerry

---- snip ----
#! /bin/sh
### showv, mhedit - show message(s) with no formatting, edit message(s)

NOMHNPROC=; export NOMHNPROC

case "$0" in
*showv)     args="${PAGER-less}" ;;
*mhedit)    args="${VISUAL-${EDITOR-vi}} -noheader" ;;
*)  echo "$0 quitting: I don't know how to run myself." 1>&2
   exit 1
   ;;
esac

exec show -showproc $args ${1+"$@"}


_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
http://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>