Elimination of mime/html part

raf mutt at raf.org
Fri May 1 01:20:54 UTC 2020


Angel M Alganza wrote:

> Hello:
> 
> I keep a few mailbox folders containing a large amount of multipart mail
> with a text/plain part and a text/html part, which I would like to
> eliminate in order to reduce the amount of disk space used (for a small
> device and mainly the IMAP server I keep synced with).
> 
> I've been looking for ways to remove the text/html part with tools like
> imapfilter or mbsync/isync that I use to manipulat, sort and
> syncronised, but I haven't had any succeed.  I can eliminate it by hand
> with Mutt, but that'd be really tedious, since I have thousands of mail.
> 
> Is there an automated way that you know of to get that done?  Or do you
> know of any third party program that could help me out?
> 
> Thank you very much in advance for your help.
> 
> Regards,
> Ángel

Hi Ángel,

I wrote a tool for replacing non-text attachments in
email with text versions. It's at http://raf.org/textmail.

By default, it replaces HTML attachments with inline
plain text attachments that contain just the text
within the original document. It also reduces
text-versus-html alternative attachments to just the
text part. It needs lynx to be installed.

If that's the only transformation you want, you'll need
to supply lots of options to prevent other default
actions. Something like this:

  textmail -MWERPULIAVXBS

That suppresses translating and deleting anything else,
just HTML.

You can use it in a procmail recipe or apply it to mbox
files.

WARNING: Please verify it carefully and make sure it's
doing what you want before deleting the original
mailboxes. Anything that transforms your email should
not be trusted until you have reason to trust it.

cheers,
raf



More information about the Mutt-users mailing list