On Mon, Mar 21, 2022 at 08:46:52AM +1100, Cameron Simpson wrote:
> On 20Mar2022 13:36, Martin Trautmann <tr...@gmx.de> wrote:
> >do you know about any mutt script that would go from message to message 
> >and
> >
> >1) remove a html part if a plain text part is given
> >
> >2) remove all trailing lines,
> >   starting with a quote sign ">"
> >   and at least e.g. 10 occurences
> >
> >  such as (^>[.*][\r\n]){9,} before the end of the message
> >
> >  Maybe I could append xzxzxzx to the end of the message first, delete 
> >a fullquote up to there and remove xzxzxzx again?
> >
> >  Bonus: Do not remove fullquotes for messages without in-reply-to or 
> >references headers.
> >
> >3) remove header lines which are longer than 5 lines
> >
> >I want to shrink the size of some mailboxes for archive purposes, 
> >without throwing away too much.
> 
> I think you'll have to write your own.
> 
> At minimum you need a full mail message parser so that you are not 
> filtering, say, base64 or QP content incorrectly. So something which 
> scans a mailbox and for each message:
> - decodes it completely
> - applies your filters
> - assembles the new message
> and write this out to a new mailbox (so it isn't destructive and can be 
> compared to the original - you don't want to accidentally shred your 
> archive).

If you want to offload some of the work to existing code, you might
look at things like GNU mailutils, or the tools that come with
maildrop, or some of the subcommands of https://github.com/djcb/mu

-- 
Mark H. Wood
Lead Technology Analyst

University Library
Indiana University - Purdue University Indianapolis
755 W. Michigan Street
Indianapolis, IN 46202
317-274-0749
www.ulib.iupui.edu

Attachment: signature.asc
Description: PGP signature

Reply via email to