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

Mutt's glasses for html email


Mutt is awesome but html email not so much… well, let me give you a possible solution: create a hotkey (F) to open html email in your favorite browser.

macro attach F \
    <enter-command>unset wait_key<enter>\
    <shell-escape>rm -f /tmp/mutt-attach<enter>\
    <shell-escape>$BROWSER /tmp/mutt-attach &<enter>\

/comments ~lucasemmoreira/ Mutt's glasses for html email

Web view in mutt

mutt config

I know for a fact that you, hypothetical reader, are a mutt user. And as such, you know how frustrating html emails can be. Recently I was having this particular problem to see Jira emails.

Behold the solution!

In the mailcap file:

text/html;      w3m -v -F -T text/html -dump %s;        copiousoutput

/comments ~lucasemmoreira/ Web view in mutt