This is a continuation of part 1 of my guide to setting up a combination of OfflineIMAP, mutt, msmtp, notmuch, and gpg on your Arch installation (or I suppose it can be extended to any standard Linux distribution. If you haven't seen part 1, you'll probably be a little lost!

When we left off on part 1, we set up OfflineIMAP to sync all of our mail to our local Maildir. If you were able to follow my poor blogging skills, you should have all of your mail synced to your local computer! Now comes the fun part, actually doing something with that mail. You can now read it!

When it comes to reading mail, I tried a couple of programs before I found one I was really happy with. For a long time, I used Thunderbird. It was great, but I found that after running it for a long time, it was taking up a huge amount of the memory on my computer. It just seemed sluggish, and I felt like I was always having to close it. So for a while, I just used webmail (I use my university's Google Apps). Eventually, however, I stumbled across . I totally geeked out on it. It let me encrypt my mail, something that I totally love in an email client. I had previously only been able to use Thunderbird for email encryption. There was a javascript greasemonkey script that used to let me do it for gmail, but it broke too often to really use. So I found mutt.

Mutt is a terminal mail client. So if you're looking for a neat GUI mail app, this client isn't for you. This is what mutt kind of looks like:

So mutt is a terminal based client. Why should I use it over GUI clients you might ask? Here's why:

  • It supports GPG with built-in functionality
  • It's FAST. It loads up fast, it hardly puts strain on your system, and it's responsive. Assuming OfflineIMAP has done it's work, I can be up and reading my email in no time.
  • The keyboard bindings can be configured, and in my case it's very vim like. I can navigate around incredibly quickly.
  • Everything about it (almost) can be configured to your needs
  • It reads email offline (not like Gmail on the web).
  • I can just copy my config file to all my computers, and have them store local versions of mail. Much better than Thunderbird!

Not convinced? Try it out for yourself! Once you get through the configuration, you'll never let go. So lets get to installing it!


I use mutt-sidebar, which shows a sidebar on the left with all of your Mailboxes. Why isn't this in the default client? I don't know. But you should use it! To get it from the AUR (using yaourt, my trusty aur client. Replace yaourt with whatever you use):

yaourt -S mutt-sidebar

Sweet! Now we have mutt-sidebar. How do we configure it? With the .muttrc file in your home directory. Instead of posting all of mine, you can take a look at it on . It's fairly documented, so check it out.

Contact auto-completion: Goobook

I like keeping all of my contact information on my main gmail account, and it remains up to date there. So how do I access that information? Goobook! Goobook is a small python app that integrates really well into mutt. How do you do it? I'll let you check out the handy guide that I used to get it going: . The relevant lines from my .muttrc for goobook integration are:

set query_command= "goobook query '%s'" bind editor complete-query macro index,pager a "goobook add" "add the sender address to Google contacts"

You can easily configure goobook to work with GPG, and the password that you used for mutt. My .goobookrc is

Sending Mail : msmtp

I use msmtp to send my mail. Installing msmtp is easy:

sudo pacman -S msmtp

The explains how to set up msmtp pretty well. I keep my .msmtprc off of Github for the fear that I'll accidentally put my passwords in it. So once you get it set up using the wiki, you should be good to send mail!

Searching through our mail: Notmuch

One thing that I find Mutt lacks is the ability to search for mail, using wildcards, on a bunch of different inboxes at once. There's an easy way to solve that: use notmuch

sudo pacman -S notmuch

It's easy to set up. I recommend checking out the  for more information, as it has a lot of good information, like how to set up notmuch originally. I just let notmuch loose on my maildir, you can . Then, as my postsynchook in my  (the configuration file for offlineimap), I call "notmuch new", which index all the new mail for notmuch.

So great! Now we have notmuch set up. How does this help us for mutt? By adding a couple of keybindings:

 macro index <F8> "<enter-command>unset wait_key<enter><shell-escape>notmuch-mutt --prompt search<enter><change-folder-readonly>`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`<enter>" \  
   "notmuch: search mail"  
 macro index <F9> "<enter-command>unset wait_key<enter><enter-command>unignore message-id<enter><pipe-message>notmuch-mutt thread<enter><change-folder-readonly>`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`<enter><enter-command>set wait_key<enter>" \  
   "search and reconstruct owning thread with notmuch"  
 macro index <F6> "<enter-command>unset wait_key<enter><enter-command>unignore message-id<enter><pipe-message>notmuch-mutt -- tag -inbox<enter>" \  
   "remove message from inbox with notmuch"  

This lets the F8 key pull up a notmuch query. You type in what you want to search for (for example, "from:"), and then mutt will open up a custom mbox with the results. Now what does F9 do? Say you find the email that you're looking for, and you want to view all of the emails that were part of that thread (all the replies, and what the target email was replying to). You can just hit F9, and notmuch will reconstruct the thread for you, and display it in mutt!



You should be set up! Your mail now goes like this:

IMAP --> OfflineIMAP --> Maildir --> [Mutt] --> msmtp

If you have any questions, or need clarifications on anything, leave a comment! I'll try to get to all of you!

arch wiki on msmtp