I'm trying to set mu4e to use for both personal and work gmail accounts. I successfully configured offlineimap and fetched the mail.

Then I tried setting mu4e, and according documentation:

the recommended way to deal with multiple accounts is through mu4e’s built-in Contexts system

Okay. I set the context values like this:

        `( ,(make-mu4e-context
             :name "home"
             :match-func (lambda (msg) (when msg (mu4e-message-contact-field-matches msg :to "[email protected]")))
             :vars '((mu4e-maildir           . "~/.mail/personal")
                     (mu4e-trash-folder      . "/[Gmail].Trash")))
             :name "work"
             :match-func (lambda (msg) (when msg (mu4e-message-contact-field-matches msg :to "[email protected]")))
             :vars '((mu4e-maildir           . "~/.mail/work")
                     (mu4e-trash-folder      . "/[Gmail].Bin"))))))

of course there's more than that, I'm showing you only the relevant piece. So the problem I'm having is have to do with deleting messages. Sometimes it works, other times it doesn't. And when it fails it throws messages like this:

  error in process filter: Error 70: error moving /Users/ag/.mail/personal/[Gmail].INBOX/cur/1457242634_2.42730.C02MT2ZDFH05,U=27933,FMD5=4b4b643246a6b95b2136ea99e0e5f614:2,S 
to /Users/ag/.mail/[Gmail].Trash/cur/1457242634_2.42730.C02MT2ZDFH05,U=27933,FMD5=4b4b643246a6b95b2136ea99e0e5f614:2,ST

You see that it picked file in personal dir and trying to move to [Gmail].Trash in root of maildir?

Actual directory tree looks more like this:

    ├── personal
    │   ├── INBOX
    │   ├── [Gmail].All\ Mail
    │   ├── [Gmail].Important
    │   ├── [Gmail].Sent\ Mail
    │   ├── [Gmail].Spam
    │   ├── [Gmail].Trash
    └── work
        ├── INBOX
        ├── [Gmail].All\ Mail
        ├── [Gmail].Bin
        ├── [Gmail].Important
        ├── [Gmail].Sent\ Mail
        ├── [Gmail].Spam

Note that mu4e-trash-folder values are different for personal and work. Honestly I dunno why - I set synclabels = yes in my offlineimaprc and that's what I got.

It seems to me, mu4e fails to set correct value of mu4e-trash-folder during context switching. Can someone help me fix that? Show me a piece of config where different folders being used for different contexts? Thanks.

  • 1
    The folders are different because your personal account uses American English and your work account uses British English. Gmail has folder names set based on your language preference.
    – nert
    Commented Oct 6, 2017 at 13:02

1 Answer 1


You can't set mu4e-maildir in contexts.

cf. http://www.djcbsoftware.nl/code/mu/mu4e/Contexts-example.html

You can set any kind of variable; including settings for mail servers etc. However, settings such as mu4e-maildir and mu4e-mu-home are not changeable after they have been set without quitting mu4e first.

So, you should set as follows:

(setq mu4e-maildir "~/.mail"
    `( ,(make-mu4e-context
         :name "home"
         :match-func (lambda (msg) (when msg (mu4e-message-contact-field-matches msg :to "[email protected]")))
         :vars '((mu4e-trash-folder      . "/personal/[Gmail].Trash")))
         :name "work"
         :match-func (lambda (msg) (when msg (mu4e-message-contact-field-matches msg :to "[email protected]")))
         :vars '((mu4e-trash-folder      . "/work/[Gmail].Bin"))))))
  • If not setting mu4e-maildir in contexts, how does mu4e know which INBOX to use? There seems to be no mu4e-inbox-folder variable...
    – AstroFloyd
    Commented May 4, 2019 at 17:04
  • 1
    mu4e doesn't have to care where INBOX is. It simply indexes folders under mu4e-maildir, and INBOX may be one of them.
    – lurdan
    Commented May 20, 2019 at 1:12
  • Ah, I see, and if I really want to jump to some particular inbox, I can define mu4e-maildir-shortcuts to go there when I type e.g. ji.
    – AstroFloyd
    Commented May 20, 2019 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.