Yes, you can use email within Emacs, and for many users it’s not just possible but a daily workflow that replaces a standalone mail client. You read, write, send, and organize messages using Emacs’ own buffers and keybindings, with your mail stored on your machine or accessed via IMAP. This article explains the main packages, how to choose one, and what to expect when you make the switch.
Why People Read Email in Emacs
Emacs is an extensible text editor that has grown into a complete computing environment. Reading mail inside it means you never leave your editor for a separate application. Your email becomes plain text you can search, script, and integrate with org-mode, your calendar, and your shell. For people who already live in Emacs, this removes a context switch and puts every message under the same keyboard-driven controls they already use.
Another reason is longevity. Emacs has been around since the 1970s, and its mail clients have been maintained for decades. Your setup file, written in Emacs Lisp, can keep working across operating systems and hardware changes. There is no vendor lock-in, no subscription, and no web interface to load.
The Main Options: Gnus, mu4e, and Notmuch
Three packages dominate modern Emacs email. Each takes a different approach, and your choice depends on how you like to work.
- Gnus is the oldest and most powerful. It started as a newsreader and grew into a full mail client. It can read mail from local files (Maildir or mbox), via IMAP, or through external programs. Gnus is incredibly flexible but has a steep learning curve and a somewhat idiosyncratic interface.
- mu4e is built on top of the
muindexer. It quickly indexes your mail and provides a fast, search-first interface. You write mail in a normal Emacs buffer, and sending is handled by your system’s sendmail or an SMTP server. mu4e is often recommended for newcomers because it feels more like a modern mail app. - Notmuch is similar to mu4e in that it uses a separate indexer. Its Emacs interface is minimal and focuses on search. Notmuch is especially good if you have a huge archive and want to find messages instantly with complex queries.
There is also Wanderlust, an older but still maintained client, and VM (View Mail), which is less common today. For a new user, mu4e or Notmuch are the usual starting points.
How It Works: Local Mail vs. IMAP
Most Emacs mail clients do not connect to a server themselves. Instead, they rely on external tools to fetch mail. The two common patterns are:
- Local mail storage: A program like
offlineimap,mbsync(from isync), orfetchmaildownloads your mail from an IMAP or POP server and stores it as files on your disk, usually in Maildir format. Emacs then reads those files. This gives you offline access and fast searching, but you must run the sync program periodically. - Direct IMAP: Gnus can talk to an IMAP server directly using Emacs’ built-in network support. This is simpler to set up (no external sync tool) but slower for large folders and does not give you offline copies unless you configure caching.
For sending mail, Emacs typically calls an external program like sendmail or msmtp, or it uses SMTP directly via the smtpmail library. You configure your SMTP server address, port, and authentication details in your Emacs init file.
Setting Up mu4e as a Concrete Example
To give you a sense of the process, here is a minimal mu4e setup. First, install mu and mu4e (often packaged together). Then, in your Emacs config, add something like this:
(require 'mu4e)
(setq mu4e-get-mail-command "mbsync -a")
(setq mu4e-update-interval 300)
(setq mu4e-sent-folder "/Sent")
(setq mu4e-drafts-folder "/Drafts")
(setq mu4e-trash-folder "/Trash")
(setq user-mail-address "you@example.com")
(setq user-full-name "Your Name")
(setq mu4e-sent-messages-behavior 'sent)
(setq message-send-mail-function 'smtpmail-send-it)
(setq smtpmail-smtp-server "smtp.example.com")
(setq smtpmail-smtp-service 587)
Then run mu init --maildir=~/Maildir once, followed by mu index to index your mail. After that, M-x mu4e opens the main view. Press U to fetch new mail (which runs mbsync), and J to jump to a folder. To compose, press C; to reply, R; to forward, F. The keybindings are discoverable via the menu bar and the ? help.
This is a simplified example. Real setups often include authentication via ~/.authinfo, multiple accounts, and hooks to tidy up after sending. But it shows the core pattern: an external sync tool, an indexer, and Emacs as the interface.
Choosing the Right Package for You
If you are new, start with mu4e. Its search is fast, its interface is clean, and its documentation and community are active. If you have a massive archive and love complex search queries, Notmuch might be better. If you want maximum control and are willing to invest time, Gnus is the most powerful but also the most demanding.
Consider your mail volume. If you get hundreds of messages per day, an indexer like mu or notmuch is almost essential. If you have a few dozen, Gnus with direct IMAP is fine. Also think about whether you need offline access. If you travel, local sync is a big advantage.
Another factor is how you handle attachments. Emacs mail clients can open attachments using external programs, but they do not render HTML mail by default. If you rely on rich HTML formatting, you will need to configure an HTML renderer (like w3m or shr) and even then, the experience is more like reading a text email with images. Many Emacs users simply prefer plain text and disable HTML entirely.
Common Problems and How to Solve Them
New users often hit the same issues. Here are the most frequent ones and their fixes.
- Mail is not being fetched. Check that your sync command works from the shell first. Run
mbsync -amanually and look for errors. Then ensuremu4e-get-mail-commandpoints to the correct command. - Authentication fails. Store your IMAP and SMTP passwords in
~/.authinfowith lines likemachine imap.example.com login you password secret. Make sure the file is readable only by you (chmod 600). - HTML messages look broken. Install an HTML renderer and set
mm-text-html-renderertow3morshr. You can also pressgin mu4e to re-render a message. - Sending fails with “No such file or directory”. This usually means Emacs cannot find
sendmail. Installmsmtpor configuresendmail-programto point to a valid binary. - Duplicate messages after sync. This is often due to a mismatch between the Maildir and the index. Run
mu index --rebuildto reindex from scratch.
Security and Privacy Considerations
Email in Emacs is as secure as the tools you use. When connecting to IMAP or SMTP, always use TLS/SSL. Most sync tools support SSL/TLS via configuration. For example, in ~/.mbsyncrc, you would set SSLType IMAPS for a port 993 connection. For SMTP, use port 587 with STARTTLS or port 465 with implicit TLS.
Your local mail files are unencrypted by default. If you are concerned about someone reading them, you can encrypt your home directory or use a tool like gpg to encrypt individual messages. Emacs also integrates with EasyPG, so you can encrypt and decrypt messages within the client.
Be careful with your .authinfo file. It contains plaintext passwords. Set its permissions to 600 and consider using GPG encryption for it (Emacs can read .authinfo.gpg). Also, be aware that any mail client, including Emacs, is vulnerable to phishing. Emacs will display links, but it does not have the same visual warnings as a graphical browser. Always check the URL before clicking.
Frequently Asked Questions
Is it hard to switch from Gmail to Emacs?
There is a learning curve, mainly because you need to configure a sync tool and learn new keybindings. But for someone comfortable with Emacs, the switch usually takes a few hours. Start by fetching all your mail with mbsync, then explore the mu4e interface. You can keep Gmail in a browser as a backup until you feel confident.
Can I use multiple email accounts in Emacs?
Yes. You can set up multiple IMAP accounts by configuring multiple sync channels in mbsync or offlineimap, and then telling mu4e which folders belong to which account. For sending, you can define multiple SMTP servers and switch based on the context. This is more involved than a single account, but it’s a common setup.
Does Emacs support attachments?
Yes. You can attach files by pressing C-c C-a in a compose buffer. To view an attachment, press RET on the attachment button in the message buffer. Emacs will offer to open it with an external program. You can also save attachments to disk.
Will my email be searchable?
Yes, if you use mu4e or Notmuch, which index your mail. Search is fast and supports complex queries like date:today from:boss subject:report. Gnus also has search, but it is slower and less powerful unless you use an external search engine like namazu or swish.
Can I use org-mode to manage my email tasks?
Absolutely. Many users integrate mu4e with org-mode. For example, you can capture a message link into an org file, or use org-msg to compose emails with org-mode markup. There are also packages like org-mime that convert org-mode content to HTML email. This is one of the most powerful reasons to use Emacs for mail.
In summary, using email within Emacs is a practical, powerful choice for those who already live in the editor. It requires some initial setup, but the payoff is a unified, scriptable, and efficient workflow. Start with mu4e, keep your config simple, and expand as you learn.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Hide PHP Version HTTP Header: How To
- CentOS Stream for Developers: A Practical Guide
- How to Replace a Game Controller Battery Safely
- Man-Sized 3D Printer? Why You Probably Don’t Need One100.0 cm³/h
- Scroll Horizontally with Mouse Wheel by Holding Shift5.00 min/km
- iPadOS 16 Supported Devices: Full List