neomutt <3 notmuch

neomutt <3 notmuch

This is a tale of stubbornness. I’ve heard about notmuch, quite sometimes and yet, I did not use it. I was bit confused reading the docs but then I read this:

Notmuch does not modify or delete your mails. This is one of the main design principles of Notmuch.

That gave me some nerves to try this on! And it is worth it!

To put it simply, notmuch is a indexer of all your emails and make search annoyingly easy. Once you go with the basics

notmuch new

A search can be done as simply as

notmuch search boardgames

notmuch will use xapian search engine to look for your emails that contain boardgames. More impressively, it can look for any kind of filter: from:, to:, cc: and so on. You can also search with tags:

notmuch search tag:bills

Now, you might wonder, how did it tag bills? Well, it did not. You must do it, like this:

notmuch tag +bills - from:*@somebilldomain*

On the right side, it used the search functionality to find all mails that satisfied the condition after -. You can also use logical expressions:

notmuch tag +boardgames +general - from:*@*boardgamestore1* or from:*@*boardgamestore2*

Now, let’s address the elephant in the room. Why bother with all this? Well, because you use neomutt =]

With neomutt, you can create mailboxes (named virtual-mailboxes) to organize your emails.

set nm_default_uri="notmuch:///path/to/mails/"
set virtual_spoolfile=yes
virtual-mailboxes "inbox" "notmuch://?query=tag:inbox"
virtual-mailboxes "boardgames" "notmuch://?query=tag:boardgames"
virtual-mailboxes "bills" "notmuch://?query=tag:bills"

What is left to use this snippet is to tag inbox:

notmuch tag +inbox - to:youremail@domain and not tag:general

This way you won’t get duplicated in your inbox, and everything you tag with general, won’t show in your inbox. Anyway, that’s what I am doing for now. But honestly, you can go crazy with it. Because notmuch is a command line, you can have an insane control over your emails. Good stuff!

Just do not forget to put it in you sync script:

mbsync -a
notmuch new
notmuch tag +boardgames - from:*@*boardgamestore1* or from:*@*boardgamestore2*
# and so on...

/comments ~lucasemmoreira/ neomutt <3 notmuch