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

Chris Bennett cpb_neomutt at bennettconstruction.us
Thu May 6 23:04:23 CEST 2021

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 missing out on content I would like to read and follow the links on
a real browser. I want to correct this.

First, I would like to just write a script to pull everything existing
over to a directory.
Afterwards, using that a similar script or one running in neomutt to
always pick those particular From: over to that directory.
But I would also like to do the same with a similar macro when I find
some other email that I really want to also move over (not one of the
From:'s above).

I'm running OpenBSD -current, so I can't just leave neomutt running in
tmux. I have to restart after every upgrade, which is often.

I'm pretty much a noobie at writing macros.
I can use ksh or bash for shell scripts, but my skills with shell
scripts are poor. I'm fine writing Perl scripts, which is my language of

I'm not sure of the right way to parse the emails and pull out the HTML
attachment bits.

Move these to another mailbox then copy out the attachment?
Some other way?

Any guidance would be appreciated.
There are tons of CPAN email modules. Adapt one of these?
Is there a simple way to parse these emails?

I haven't started any of this yet. I wanted to get some suggestions if
anyone has already done this or something similar. I definitely don't
want all the HTML attachments. So much junk!

I do have some existing software which I used to post all messages to a
forum I used to run. I didn't write it and it's been years since I
looked at it.

Forwarding these particular emails to another email address would also
be OK to then pull out the HTML attachments out of.

I'm open to any ideas.
I run the servers, so no problems with that.

Thanks in advance,
Chris Bennett

More information about the neomutt-users mailing list