[neomutt-users] Macro (plus a script to one shot) move selected From's HTML email attachments to a directory

Krzysztof Konopko krzysztof.konopko at amk.zone
Fri May 7 08:56:28 CEST 2021

On Thu, May 06, 2021 at 04:04:23PM -0500, Chris Bennett wrote:
Hi Chris,

> Hi,
> I use SSH to read my emails on the servers, not at home.
> I have several regular emails from biochemistry and electrician related
> mailing lists. Other HTML attachments work fine with just Lynx.
> I really haven't been manually moving these attachments to a website
> that I can read these through Firefox/Chromium, etc. at home or on my
> phone. Too much work manually doing this.
> I'm using Maildir with Dovecot LMTP and IMAP.

I'm far from being a (neo)mutt power-user and I'm still learning, but
thought I'd share how I approached what I think is a similar problem.

I get emails from WebKit [1] with diffs which use pesky HTML and which I
still want to view as plain coloured diffs in my terminal (in neomutt).
So I set up a hook for these messages:

    message-hook '~s \\[webkit-changes' "\
        set allow_ansi; \
        set mailcap_path=~/.config/neomutt/mailcap-webkit \

In that special mailcap I use a dedicated filter:

    text/html; ~/.config/neomutt/filters/webkit-changes 2>/dev/null; copiousoutput

which is based on filters I borrowed from aerc email client [2] (`html` and



    $filter_path/html |
    sed -E -e 's/(\[|:)(INS|DEL)(:|\])//g' -e 's/^Diff/diff /' |
    awk -f $filter_path/hldiff

The key here is the `html` filter (check it in aerc [3]) which uses `w3m`
for rendering/filtering HTML in terminal.  This provides all links at
the bottom to follow (if I need to).  Also the aerc filter uses
`socksify` to avoid phoning home from HTML but I replaced it with a fake
proxy:  `http_proxy=""`.

I'm not sure if any of this helps you, but maybe at least it inspires
some thought.


[1] https://lists.webkit.org/mailman/listinfo/webkit-changes
[2] https://aerc-mail.org/
[3] https://git.sr.ht/~sircmpwn/aerc/tree/master/item/filters/html

More information about the neomutt-users mailing list