Multiple accounts support for mu4e.
- Author: Fabián Ezequiel Gallina
- Contact: fgallina at gnu dot org
- Project homepage: http://github.com/fgallina/mu4e-multi
- My Blog: http://www.from-the-cloud.com
mu4e-multi where you place all your Emacs Lisp files and
(optionally) byte-compile it. One way to do it is to visit the file
with Emacs and then issue
After that add the following to your
(add-to-list 'load-path "/folder/containing/file") ;; if it's not already in `load-path' (require 'mu4e-multi)
mu4e-multi just depends on setting the
properly and calling
As an example let's assume you have two email accounts: personal and work. For handling such accounts mu4e-multi assumes your maildir's layout is as follows:
+ Maildir +-- personal +---- Inbox +---- Sent ... +-- work +---- Inbox +---- Sent ..
This is what you'd have in your .emacs:
(require 'mu4e-multi) (setq mu4e-multi-account-alist '(("personal" (user-mail-address . "firstname.lastname@example.org") (mu4e-drafts-folder . "/personal/Drafts") (mu4e-follow-up-folder . "/personal/FollowUp") (mu4e-hold-folder . "/personal/Hold") (mu4e-refile-folder . "/personal/Archived") (mu4e-sent-folder . "/personal/Sent") (mu4e-trash-folder . "/personal/Trash")) ("work" (user-mail-address . "email@example.com") (mu4e-drafts-folder . "/work/Drafts") (mu4e-follow-up-folder . "/work/FollowUp") (mu4e-hold-folder . "/work/Hold") (mu4e-refile-folder . "/work/Archived") (mu4e-sent-folder . "/work/Sent") (mu4e-trash-folder . "/work/Trash")))) (mu4e-multi-enable)
This alist key is the nickname of the account, which I strongly recommend that you make it match your maildir's sub-folder as in the example. For every cons in the alist, its car is the symbol of the variable to be set for this particular account and its cdr is its new value.
mu4e-multi-enable makes mu4e standard folders to be aware of
the multiple account configuration by setting
a callable that would properly set folders for each account, and will
message-mode-hook to detect and set the current account
variables based on the email address. If for some reason you wish to
rollback these changes, just call
Custom folders and markers
Notice that, in our example, the
mu4e-follow-up folders are not really standard ones, but since I use
the GTD approach on handling emails I needed them.
Now, the thing is that mu4e obviously won't have commands to mark
messages to be moved to such folders, but thanks to mu4e-multi's
mu4e-multi-make-mark-for-command macro, you can generate those
;; Creates `mu4e-multi-mark-for-hold' command. (mu4e-multi-make-mark-for-command mu4e-hold-folder) ;; Creates `mu4e-multi-mark-for-follow-up' command. (mu4e-multi-make-mark-for-command mu4e-follow-up-folder)
Now the only thing left is to add these new commands to the
(define-key 'mu4e-headers-mode-map "h" 'mu4e-multi-mark-for-hold) (define-key 'mu4e-headers-mode-map "f" 'mu4e-multi-mark-for-follow-up)
To compose a new email, mu4e-multi comes with a wrapper over
mu4e-multi-compose-new which takes care of
detecting and handling account vars properly when composing new
It's strongly recommended you use this over
is how I bind it my local setup:
(global-set-key (kbd "C-x m") 'mu4e-multi-compose-new)
mu4e-multi comes with
is a function intended to be added to the
which will take care of appending the current account nickname to the
Note that for this to work properly, all your defined account sections
of your .msmtprc must match your
If you happen to be using msmtp, enable this feature like this:
(add-hook 'message-send-mail-hook 'mu4e-multi-smtpmail-set-msmtp-account)
NOTE: I haven't tested this in Emacs versions less than 24.x.
If you find a bug please report it in the github tracker.
mu4e-multi is free software under the GPL v3, see LICENSE file for details.