# Notmuch Emacs interface

> Emacs front end for notmuch that reads, searches, tags and composes mail from a local Maildir.

The Notmuch Emacs interface (notmuch.el) ships with notmuch and runs inside GNU Emacs. It replaces folders with saved searches and tags stored in the notmuch Xapian index, and shows whole threads in one buffer. Mail must be synced to a local Maildir by a tool such as mbsync, and outgoing mail goes through Emacs message mode with smtpmail or a sendmail-compatible program such as msmtp. It suits Emacs users who organize mail with tags and search instead of folders.

- Type: Email client
- Interface: Runs inside Emacs
- Systems: Runs on Linux, macOS and BSD, on Windows through WSL, on Android through Termux.
- Language: Emacs Lisp
- License: GPL 3.0 or later (GPL-3.0-or-later)
- Latest version: 0.40
- Background: Part of the notmuch project
- Maintained: yes
- Website: https://notmuchmail.org/notmuch-emacs/
- Source: https://git.notmuchmail.org/git/notmuch
- Documentation: https://notmuchmail.org/doc/latest/notmuch-emacs.html

## Install

### Linux

Native.

- apt: `sudo apt install elpa-notmuch isync msmtp`
- dnf: `sudo dnf install emacs-notmuch isync msmtp`
- pacman: `sudo pacman -S notmuch emacs isync msmtp`

### macOS

Native.

- Homebrew: `brew install notmuch emacs isync msmtp`

### Windows

Through WSL. notmuch has no native Windows build or MSYS2 package; run Emacs and notmuch in WSL.

- WSL: `sudo apt install elpa-notmuch isync msmtp`

### BSD

Native.

- FreeBSD pkg: `pkg install notmuch-emacs isync msmtp`
- OpenBSD: `pkg_add notmuch-emacs isync msmtp`

### Android

Through Termux.

- Termux: `pkg install notmuch emacs isync msmtp`

## Protocols

- IMAP: Through a separate tool
- POP3: Through a separate tool
- SMTP: Yes
- JMAP: No
- Maildir: Yes
- mbox: No
- notmuch: Yes

## Features

- OpenPGP: Yes
- S/MIME: Yes
- OAuth2 sign-in: via script
- Threads: Yes
- Search: notmuch Xapian full-text search with tags
- HTML mail: built-in, rendered with the Emacs shr library
- Mouse: Yes
- Multiple accounts: Yes
- Offline use: full; reads a local Maildir synced by mbsync or OfflineIMAP
- Calendar: shows text/calendar parts; no invitation replies
- Contacts: address completion from the notmuch index
- Vim-style keys: No
- Configuration: Emacs Lisp in init.el plus the notmuch config file

## Pros

- Tag-based organization with fast full-text search over all local mail.
- Shows a whole thread in a single buffer.
- Handles PGP/MIME and S/MIME signatures and decryption through notmuch.

## Cons

- No built-in IMAP; needs mbsync or a similar sync tool.
- Custom tags stay in the local index; only standard flags such as unread and replied reach the IMAP server.
- Requires Emacs and some Emacs Lisp to configure.

## Use Notmuch Emacs interface with Forward Email

File: `~/.mbsyncrc, ~/.config/msmtp/config and ~/.emacs.d/init.el`

```
# 1) ~/.mbsyncrc: sync the mailbox to ~/Mail/forwardemail (isync 1.5+ syntax)
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 *

# 2) Index: run "notmuch setup" (database path ~/Mail, address you@example.com),
#    then: mbsync forwardemail && notmuch new

# 3) ~/.config/msmtp/config (chmod 600)
account forwardemail
host smtp.forwardemail.net
port 465
tls on
tls_starttls off
auth on
user you@example.com
passwordeval "pass show email/forwardemail"
from you@example.com
account default : forwardemail

# 4) ~/.emacs.d/init.el
(require 'notmuch)
(setq user-mail-address "you@example.com"
      user-full-name "Your Name"
      message-send-mail-function 'message-send-mail-with-sendmail
      sendmail-program "msmtp"
      message-sendmail-envelope-from 'header
      mail-specify-envelope-from t
      notmuch-fcc-dirs "\"forwardemail/Sent Mail\" +sent -inbox -unread")
```

| Protocol | Server | Port | Security |
| --- | --- | --- | --- |
| IMAP | imap.forwardemail.net | 993 | SSL/TLS |
| POP3 | pop3.forwardemail.net | 995 | SSL/TLS |
| SMTP | smtp.forwardemail.net | 465 | SSL/TLS |
| SMTP | smtp.forwardemail.net | 587 | STARTTLS |

Username: your full alias address. Password: the one from Generate Password next to the alias. Folders: INBOX, Drafts, Sent Mail, Trash, Spam and Archive.

## Questions

### Does Notmuch Emacs interface work on Windows?

Not natively. It runs in Windows Subsystem for Linux (WSL). notmuch has no native Windows build or MSYS2 package; run Emacs and notmuch in WSL.

### Does Notmuch Emacs interface support IMAP?

Through a separate tool. Notmuch Emacs interface reads local mail, so a sync program such as isync copies it from the IMAP server.

### Is Notmuch Emacs interface open source?

Yes, under the GPL 3.0 or later.

### How do I use Notmuch Emacs interface with Forward Email?

Use the config in the Forward Email section on this page, saved as ~/.mbsyncrc, ~/.config/msmtp/config and ~/.emacs.d/init.el, and replace the address and password with your own.

## Sources

- https://notmuchmail.org/
- https://notmuchmail.org/notmuch-emacs/
- https://notmuchmail.org/doc/latest/notmuch-emacs.html
- https://git.notmuchmail.org/git/notmuch
- https://git.notmuchmail.org/git/notmuch/blob/HEAD:/COPYING
- https://git.notmuchmail.org/git/notmuch/blob/HEAD:/NEWS
- https://git.notmuchmail.org/git/notmuch/blob/HEAD:/emacs/notmuch-maildir-fcc.el
- https://git.notmuchmail.org/git/notmuch/blob/HEAD:/emacs/notmuch-show.el
- https://notmuchmail.org/releases/
- https://packages.debian.org/trixie/elpa-notmuch
- https://mdapi.fedoraproject.org/rawhide/pkg/emacs-notmuch
- https://archlinux.org/packages/extra/x86_64/notmuch/
- https://formulae.brew.sh/formula/notmuch
- https://github.com/Homebrew/homebrew-core/blob/main/Formula/n/notmuch.rb
- https://www.freshports.org/mail/notmuch-emacs/
- https://github.com/openbsd/ports/blob/master/mail/notmuch/Makefile
- https://github.com/termux/termux-packages/blob/master/packages/notmuch/build.sh
- https://packages.msys2.org/api/search?query=notmuch
- https://sourceforge.net/p/isync/isync/ci/master/tree/src/mbsync.1.in
- https://git.marlam.de/gitweb/?p=msmtp.git;a=blob;f=doc/msmtp.texi
- https://github.com/forwardemail/forwardemail.net/blob/master/helpers/ensure-default-mailboxes.js
