Terminal Email

notmuch

CLIMail tool

Command-line mail indexer that adds fast full-text search, threading and tags to a local Maildir.

notmuch indexes messages in a local Maildir with Xapian and lets you search, thread and tag them from the command line. It does not fetch or send mail; a sync tool such as mbsync and an SMTP client such as msmtp handle that. Several mail clients use it as their back end, including its own Emacs interface, alot, aerc and NeoMutt. It suits users who want tags and search instead of folders.

Type
Mail tool
Interface
Command-line tools and prompts
Systems
Runs on Linux, macOS and BSD, on Windows through WSL, on Android through Termux.
Language
C, C++
License
GPL 3.0 or later
Latest version
0.40
Maintained
Yes
Website
notmuchmail.org
Source
git.notmuchmail.org/git/notmuch
Documentation
notmuchmail.org

Install

SystemSupportInstall
LinuxNative
aptsudo apt install notmuch
dnfsudo dnf install notmuch
pacmansudo pacman -S notmuch
macOSNative
Homebrewbrew install notmuch
WindowsThrough WSL
WSLsudo apt install notmuch

No native Windows build or MSYS2 package; run it in WSL.

BSDNative
FreeBSD pkgpkg install notmuch
OpenBSDpkg_add notmuch
AndroidThrough Termux
Termuxpkg install notmuch

Protocols and features

Protocols
Protocolnotmuch
IMAPNo
POP3No
SMTPNo
JMAPNo
MaildirYes
mboxNo
notmuchYes
Features
Featurenotmuch
OpenPGPYes
S/MIMEYes
OAuth2 sign-inNo
ThreadsYes
SearchXapian full-text search with tags and date ranges
HTML mailNo
MouseNo
Multiple accountsindexes every Maildir under one database path
Offline usefull; works only on local mail
CalendarNo
Contactsnotmuch address lists addresses from indexed mail
Vim-style keysNo
ConfigurationINI-style notmuch config file

Pros and cons

Pros

  • Fast full-text search and tagging over large local mail stores.
  • Used as a back end by several clients, so one index serves more than one front end.
  • Can index and search decrypted PGP/MIME and S/MIME messages.

Cons

  • Does not fetch or send mail; needs mbsync and msmtp or similar tools.
  • Custom tags stay in the local index; only standard flags such as unread and replied sync to Maildir, and from there to IMAP.
  • No native Windows build.

Use notmuch with Forward Email

How notmuch fits with a Forward Email mailbox. Replace you@example.com with your alias and the password command with your own. The same settings work with any provider once the server names change.

~/.mbsyncrc and ~/.notmuch-config
# notmuch only indexes local mail. Sync Forward Email to ~/Mail first with mbsync (~/.mbsyncrc):
IMAPAccount forwardemail
Host imap.forwardemail.net
Port 993
User you@example.com
PassCmd "pass show email/forwardemail"
TLSType IMAPS

IMAPStore forwardemail-remote
Account forwardemail

MaildirStore forwardemail-local
SubFolders Verbatim
Path ~/Mail/forwardemail/
Inbox ~/Mail/forwardemail/INBOX

Channel forwardemail
Far :forwardemail-remote:
Near :forwardemail-local:
Patterns *
Create Both
SyncState *

# ~/.notmuch-config
[database]
path=/home/you/Mail
[user]
name=Your Name
primary_email=you@example.com
[new]
tags=unread;inbox;

# Then: mbsync forwardemail && notmuch new
# Search: notmuch search tag:unread from:someone@example.org
ProtocolServerPortSecurity
IMAPimap.forwardemail.net993SSL/TLS
POP3pop3.forwardemail.net995SSL/TLS
SMTPsmtp.forwardemail.net465SSL/TLS
SMTPsmtp.forwardemail.net587STARTTLS

Username: your full alias address, such as you@example.com. Password: the one shown by Generate Password next to the alias in your Forward Email account. Folders: INBOX, Drafts, Sent Mail, Trash, Spam and Archive.

Prefer no config at all? Forward Email's terminal app signs in with your account and has mail, calendar and contacts in one program.

Questions

Does notmuch work on Windows?

Not natively. It runs in Windows Subsystem for Linux (WSL). No native Windows build or MSYS2 package; run it in WSL.

Does notmuch support IMAP?

No. notmuch does not use IMAP.

Is notmuch open source?

Yes, under the GPL 3.0 or later.

How do I use notmuch with Forward Email?

Use the config in the Forward Email section on this page, saved as ~/.mbsyncrc and ~/.notmuch-config, and replace the address and password with your own.

Sources