Email client (mu4e) in Emacs

Last Updated: Apr 8, 2026

When I was running Void Linux on my ThinkPad X61, I had to install minimal xfce4 for i3wm despite that I didn’t want any desktop environment (DE) on it. Now, I switched to Debian 13 but it runs EXWM (see this post) now. It still has to install minimal xfce4 tools, such as thunar if I want to use Firefox, but there’s practically no appearance of any GUI thing in Emacs.

In i3wm I used to use Thunderbird client diectly, but now I can’t do that very conveniently. I could install and open Thunderbird in an Emacs buffer, just like how I open Firefox, but Emacs has good integration with basic IMAP accounts. Although I can’t use school email or other Gmail accounts, I don’t really mind because this computer is my hobby machine anyways.

For minimal setup, this was everything on Emacs side. Note that the default location of Isync and msmtprc are in home directory, in my case it’s .config. For Isync it’s not specified in the Emacs config, but I might have set it somewhere else.

(use-package mu4e 
  :config 
  (setq mu4e-maildir "~/.mail/personal/" 
        mu4e-get-mail-command "mbsync personal" 
        mu4e-update-interval 300 
        mu4e-inbox-folder "/Inbox" 
        mu4e-sent-folder "/Sent" 
        mu4e-drafts-folder "/Draft" 
        mu4e-trash-folder "/Trash" 
        mu4e-refile-folder "/Junk" 
        mu4e-compose-signature-include-separator nil 
        mu4e-compose-signature "Makihiro" 
        user-mail-address "[email protected]" 
        user-full-name "Makihiro GO") 
  (setq sendmail-program "msmtp" 
        send-mail-function #’sendmail-send-it 
        message-sendmail-f-is-evil t 
        message-sendmail-extra-arguments (list "--read-envelope-from" "-C" (expand-file-name "~/.config/msmtprc") "-a" "personal") 
        message-send-mail-function #’message-send-mail-with-sendmail))

In ~/.config, it needs one Isync config for incoming emails and one msmtp config for outgoing emails.

# Isync 
IMAPAccount personal 
Host <your-email-server> 
User [email protected] 
PassCmd "gpg --quiet --for-your-eyes-only --no-tty --pinentry-mode loopback --passphrase <your-passphrase> --decrypt ~/.mailpass.gpg" 
TLSType IMAPS 
Port 993 
CertificateFile /etc/ssl/certs/ca-certificates.crt 
 
IMAPStore personal-remote 
Account personal 
 
MaildirStore personal-local 
Path ~/.mail/personal/ 
Inbox ~/.mail/personal/Inbox 
Subfolders Verbatim 
 
Channel personal 
Master :personal-remote: 
Slave :personal-local: 
Patterns * 
Create Both 
Expunge Both 
Sync All 
SyncState 1
# msmtp 
account personal 
host <your-email-server (smtp)> 
port 465 
tls on 
tls_starttls off 
auth on 
user [email protected] 
passwordeval "gpg --quiet --for-your-eyes-only --no-tty --pinentry-mode loopback --passphrase <your-passphrase> --decrypt ~/.mailpass.gpg" 
from [email protected] 
account default : personal

Oath2 does not work (or I just don’t know), but passwords do. There are multiple ways to setup the password encryption. I use Gnupg:

$ printf ’%s’ ’password’ > ~/.mailpass 
$ chmod 600 ~/.mailpass 
$ gpg --symmetric ~/.mailpass

If gpg --decrypt ~/.mailpass.gpg successfully decrypts the passphrase, it’s done but if you have a passphrase for it, you need to pass --pinentry-mode loopback --passphrase <your-passphrase> in PassCmd and passwordeval.

# PassCmd for Isync and passwordeval for msmtprc 
"gpg --quiet --for-your-eyes-only --no-tty --pinentry-mode loopback --passphrase <your-passphrase> --decrypt ~/.mailpass.gpg"

Further Configurations