Best practices for notmuch and neomutt

Kim ALLAMANDOLA kim-nmml at
Tue Mar 3 13:10:38 PST 2020

mine it's not really a neomutt workflow, but a notmuch one (I use
notmuch-emacs), I do not know how much can be ported to neomutt

I use tags a bit, with afew as autotagger. In the past I've used
a simple script that wrap

  notmuch tag --batch <<EOM
  +tag query
  +othertag otherquery

But I decide to switch for afew due to it's move mail mode to
autorefile messages, using tags as driver, for instance mail
from my ISP, get few tags: s/FreeBox and s/ISP, if there is a
certain subject and an attachment also d/invoices. Afew in mail
move mode grab from INBOX any new message tagged with s/FreeBox
and move the mail to the corresponding directory, named after
the tag. Also refile sent messages to the appropriate directory,
if any.

The tags taxonomy is essentially

 - ml/ for mailing lists
 - s/ for stakeholders 
 - v/ for vendors
 - p/ for people
 - c/ comment/social networks
 - n/ messages form bot/notification/automatic systems etc
 - a/ alert, a subset of n/
 - x/ appointments and others agenda related
 - w/ work related
 - t/ taxonomy|account related like t/account1/sent etc
 - A/ aliases (I have many, essentially one per correspondent)
 - ...

For instance these messages get ml/notmuch tag. If Neomutt can
"browse" virtual folders created after notmuch queries I think
it can be applied without issues. 

Then I have saved searches like

 - unread (group all unread messages from any account and dir.)
 - critical a query for messages that can be critical (system failures,
   home CCTV alerts, ...), a subset of unread
 - important as above another subset of unread
 - live read messages about "inprogress things"
 - notes (quick autosent notes from myself)
I have 4 mail account, all under a common ~/mail maildir, indexed by
notmuch, tags are mostly used to help searches when I do not want to
type queries or I do not found something easily with a query.

Maildir taxonomy is similar to tags

the practical difference is that not all tags have a correspondent
directory and messages are not duplicated while I have many tags
per messages...

In the past I've used IMAPFilter, it's far superior than afew for
filtering (refiling mails) but it lack notmuch integration so I
drop it.

For trying to keep my maildir clean I have a periodic "cleaner",
a simple series of notmuch queries piped to rm that collect
messages by dates and "kind" (tag). For instance messages about
shipment notifications from Amazon/eBay/Aliexpress/... get
deleted if not flagged and older that 356 days, messages from
certain people not flagged get deleted after two years etc. It
does not work much in the sense that my maildir keeps growing but
work enough for now... Periodically when an idea pops up I add
another query with another deletion...

I've tried a bit more automation, with uudeview, mblaze, pdfgrep
etc for instance to extract invoices from my ISP, utility bills etc
and archive the pdf with a proper file name in a proper taxonomy,
adding an entry in my org-agenda, journal, looking after a certain
period of time if my ledger contains the correspondent transaction
and adding an alert in agenda if it's not found etc. but after a
first spaghetti-code script implementation for my ISP and mobile
carrier I quit, it's simply too long an too much "specific" to
be useful, too much work to keep it up than the work needed to
do the same manually.

I've used in the past RSS2Email so I can read my feeds via mail,
have the indexed by notmuch, easy to share if I wish etc but due
to the actual status of feeds where most sites only push a title
and a link to the real article I quit since I can't really read
feeds without a browser so it's not useful have them archived.
A real shame... Miniflux (a feed reader) have some mechanism to
download the article for site that does not push it, but I do
not know how to implement it via mail so I quit, it's too much

Last but not least: the real key to do all the above is IME have
tons of alias so querying them is easy, without the to: queries
it will be really hard to keep anything "safely working".

-- Kim

More information about the notmuch mailing list