.. | ||
autoload | ||
config.el | ||
doctor.el | ||
packages.el | ||
README.org |
email/mu4e
Table of Contents TOC
Description
This module makes Emacs an email client, using mu4e
.
I want to live in Emacs, but as we all know, living is incomplete without email. So I prayed to the text editor gods and they (I) answered. Emacs+evil's editing combined with org-mode for writing emails? Yes please.
It uses
mu4e
to read my email, but depends onofflineimap
(to sync my email via IMAP) andmu
(to index my mail into a formatmu4e
can understand).
Module Flags
+gmail
Enables gmail-specific configuration for mailTo
orFrom
a gmail address, or a maildir withgmail
in the name.
Plugins
To disable either of these packages, simply add
(package! X :disable t)
to your config (where X
is the package in question) and it will not be used.
Prerequisites
This module requires:
- Either
mbsync
(default) orofflineimap
(to sync mail with) mu
, to index your downloaded messages and to provide themu4e
package.
MacOS
brew install mu
# And one of the following
brew install isync # mbsync
brew install offlineimap
Arch Linux
Run one of the following commands.
sudo pacman -S isync # mbsync
# OR
sudo pacman -S offlineimap
Install mu
, which is not available in the main repositories but in the AUR, by
using for example the AUR helper yay
.
yay -S mu
NixOS
environment.systemPackages = with pkgs; [
mu
# And one of the following
isync
offlineimap
];
openSUSE
Remove #
in #sync_program=offlineimap
to choose offlineimap
instead of
mbsync
.
sync_program=isync # mbsync
#sync_program=offlineimap
sudo zypper install maildir-utils $sync_program
Debian/Ubuntu
Run the command corresponding to the desired backend and the last one.
sudo apt-get install isync # mbsync
# or
sudo apt-get install offlineimap
# then
sudo apt-get install maildir-utils mu4e # mu and mu4e respectivly
Features
- Tidied mu4e headers view, with flags from
all-the-icons
- Consistent colouring of reply depths (across compose and gnus modes)
- Prettified
mu4e:main
view - Cooperative locking of the
mu
process. Another Emacs instance may request access, or grab the lock when it's available. -
org-msg
integration- can be toggled per-message by applying the
universal argument (
SPC u
) to the compose/reply/forward action. - The initial value of
+mu4e-compose-org-msg-toggle-next
determines the default composition mode (this can be toggled withM-x org-msg-mode
as usual). - A revamped custom style, with an accent colour that can be customised by
setting
+org-msg-accent-color
)
- can be toggled per-message by applying the
universal argument (
- Gmail integrations with the
+gmail
flag, which account for the different behaviour. This is applied when using addresses which contain@gmail.com
or havegmail
in the maildir name. You can use+mu4e-gmail-addresses
when you want an address to be treated as such but it meets neither conditions (e.g. with Gsuite). - Email notifications with
mu4e-alert
, and (on Linux) a customised notification style
Configuration
offlineimap
This module uses mbsync
by default. To use offlineimap
, change +mu4e-backend
:
(setq +mu4e-backend 'offlineimap)
Next, you need to write a configuration file for offlineimap
. Mine can be found
in my dotfiles repository. It is configured to download mail to \~/.mail
. I
use unix pass to securely store my login credentials. You can find a very
detailed configuration here.
Next you can download your email with offlineimap -o
. This may take a while,
especially if you have thousands of mails.
You can now proceed with the mu and mu4e section.
mbsync
The steps needed to set up mu4e
with mbsync
are very similar to the ones for
offlineimap.
Start with writing a \~/.mbsyncrc
. An example for Gmail can be found on
pragmaticemacs.com. A non-Gmail example is available as a gist here. The manual
page contains all needed information to set up your own.
Next you can download your email with mbsync --all
. This may take a while, but
should be quicker than offlineimap
;).
You can now proceed with the mu and mu4e section.
Faster syncing
It's possible to use IMAP IDLE to be quickly notified of updates, then use a
tailored mbsync
command to just fetch the new changes.
If this is of interest, this approach can be seen in @tecosaur's config where goimapnotify is used for this.
mu and mu4e
You should have your email downloaded already. If you have not, you need to set
offlineimap
or mbsync
up before you proceed.
Before you can use mu4e
or the cli program mu
, you need to index your email
initially. How to do that differs a little depending on the version of mu
you
use. You can check your version with mu --version
.
For mu
>=1.4 you need to run two commands:
mu init --maildir ~/.mail --my-address email@example.com
mu index
mu
<1.4 only requires one command:
mu index --maildir ~/.mail
Then configure Emacs to use your email address:
;; Each path is relative to `+mu4e-mu4e-mail-path', which is ~/.mail by default
(set-email-account! "Lissner.net"
'((mu4e-sent-folder . "/Lissner.net/Sent Mail")
(mu4e-drafts-folder . "/Lissner.net/Drafts")
(mu4e-trash-folder . "/Lissner.net/Trash")
(mu4e-refile-folder . "/Lissner.net/All Mail")
(smtpmail-smtp-user . "henrik@lissner.net")
(user-mail-address . "henrik@lissner.net") ;; only needed for mu < 1.4
(mu4e-compose-signature . "---\nHenrik Lissner"))
t)
OrgMsg
By default, org-msg-mode
is enabled before composing the first message.
To disable org-msg-mode
by default, simply
(setq mu4e-compose--org-msg-toggle-next nil)
To toggle org-msg for a single message, just apply the universal argument to the
compose or reply command (SPC u
with evil
, C-u
otherwise).
Troubleshooting
No such file or directory, mu4e
You will get No such file or directory, mu4e
errors if you don't run doom
sync
after installing mu
through your package manager.
Some times the the mu
package does not include mu4e
(cough Ubuntu).
if that's the case you will need to install it and add it to your load-path
you can do that by…
(add-to-list 'load-path "your/path/to/mu4e")
;; if you installed it using your package manager
(add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e")
;; if you built from source
(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e")
If you have completely lost your install then you can use this handy command!
find / -type d -iname '*mu4e*'
# I reccomend rerouting all of the error to /dev/null
find / -type d -iname '*mu4e*' 2> /dev/null
(void-function org-time-add)
error on Gentoo
Gentoo users will see this error because the net-mail/mu
package eagerly loads
mu4e
(which pulls in org
) much too early; before Emacs reads ~/.emacs.d
.
So early, that it loads the built-in version of org-mode, rather than the newer
version that Doom installs.
Later versions of the net-mail/mu
package have fixed this issue, but you may
need to switch to the unstable build of net-mail/mu
to see it.