# mu4e

> Email client that runs inside GNU Emacs, built on the mu Maildir indexer and search tool.

mu4e reads mail from a local Maildir that mu indexes with Xapian, and its views are search queries rather than folders. Mail is fetched by a separate program such as mbsync (isync), and sent through Emacs smtpmail or an external sendmail-compatible program. It reuses the Gnus message and article modes, so signing, encryption and HTML rendering come from Emacs. It suits Emacs users who keep mail offline and want fast full-text search.

- 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 (mu4e), C++ (mu)
- License: GPL 3.0 or later (GPL-3.0-or-later)
- Latest version: 1.14.3
- Background: Emacs front end of the mu project
- Maintained: yes
- Website: https://www.djcbsoftware.nl/code/mu/mu4e.html
- Source: https://github.com/djcb/mu
- Documentation: https://www.djcbsoftware.nl/code/mu/mu4e/

## Install

### Linux

Native.

- apt: `sudo apt install mu4e isync`
- dnf: `sudo dnf install maildir-utils isync emacs`
- AUR: `yay -S mu isync`

### macOS

Native.

- Homebrew: `brew install mu isync emacs`

### Windows

Through WSL. mu has no Windows package and upstream calls native Windows support experimental; run Emacs, mu and mbsync in WSL.

- WSL: `sudo apt install mu4e isync`

### BSD

Native.

- FreeBSD pkg: `pkg install mu isync`
- OpenBSD: `pkg_add mu isync`

### Android

Through Termux.

- Termux: `pkg install mu isync`

## Protocols

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

## Features

- OpenPGP: Yes
- S/MIME: via Emacs MML
- OAuth2 sign-in: via script
- Threads: Yes
- Search: Xapian full-text index with mu query syntax
- HTML mail: built-in, rendered with the Emacs shr library
- Mouse: Yes
- Multiple accounts: via contexts
- Offline use: full; reads a local Maildir synced by mbsync or OfflineIMAP
- Calendar: replies to invitations with mu4e-icalendar
- Contacts: address completion from indexed mail
- Vim-style keys: No
- Configuration: Emacs Lisp in init.el

## Pros

- Full-text search over all local mail through mu's Xapian index.
- Works offline, since all mail lives in a local Maildir.
- Uses Emacs message mode, so PGP/MIME, S/MIME and Org mode links are available.

## Cons

- No built-in IMAP; needs mbsync or a similar sync tool, so setup spans several config files.
- Requires Emacs and some Emacs Lisp to configure.
- No native Windows build, and Arch packages it only in the AUR.

## Use mu4e with Forward Email

File: `~/.mbsyncrc 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 * !Drafts
Create Both
Expunge Both
SyncState *

# 2) First sync and index:
#    mbsync forwardemail
#    mu init --maildir=~/Mail --personal-address=you@example.com && mu index

# 3) ~/.emacs.d/init.el
(require 'mu4e)
(setq user-mail-address "you@example.com"
      user-full-name "Your Name"
      mu4e-get-mail-command "mbsync forwardemail"
      mu4e-change-filenames-when-moving t
      mu4e-sent-folder "/forwardemail/Sent Mail"
      mu4e-drafts-folder "/forwardemail/Drafts"
      mu4e-trash-folder "/forwardemail/Trash"
      message-send-mail-function 'smtpmail-send-it
      smtpmail-smtp-server "smtp.forwardemail.net"
      smtpmail-smtp-service 465
      smtpmail-stream-type 'ssl
      smtpmail-smtp-user "you@example.com")

# 4) SMTP password in ~/.authinfo.gpg (read by Emacs auth-source):
# machine smtp.forwardemail.net login you@example.com port 465 password YOUR-GENERATED-PASSWORD
```

| 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 mu4e work on Windows?

Not natively. It runs in Windows Subsystem for Linux (WSL). mu has no Windows package and upstream calls native Windows support experimental; run Emacs, mu and mbsync in WSL.

### Does mu4e support IMAP?

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

### Is mu4e open source?

Yes, under the GPL 3.0 or later.

### How do I use mu4e with Forward Email?

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

## Sources

- https://www.djcbsoftware.nl/code/mu/mu4e.html
- https://www.djcbsoftware.nl/code/mu/mu4e/
- https://github.com/djcb/mu
- https://github.com/djcb/mu/blob/master/README.org
- https://github.com/djcb/mu/blob/master/COPYING
- https://github.com/djcb/mu/blob/master/mu4e/mu4e.texi
- https://github.com/djcb/mu/blob/master/man/mu-init.1.org
- https://formulae.brew.sh/formula/mu
- https://packages.debian.org/trixie/mu4e
- https://src.fedoraproject.org/rpms/maildir-utils/blob/rawhide/f/maildir-utils.spec
- https://aur.archlinux.org/packages/mu
- https://github.com/freebsd/freebsd-ports/blob/main/mail/mu/Makefile
- https://github.com/openbsd/ports/blob/master/mail/mu/Makefile
- https://github.com/termux/termux-packages/blob/master/packages/mu/build.sh
- https://packages.msys2.org/api/search?query=mu
- https://sourceforge.net/p/isync/isync/ci/master/tree/src/mbsync.1.in
- https://github.com/emacs-mirror/emacs/blob/emacs-31/lisp/mail/smtpmail.el
- https://github.com/forwardemail/forwardemail.net/blob/master/helpers/ensure-default-mailboxes.js
