10 Dynamic folders

In Folders, we explained how you can set up mu4e’s special folders:

  mu4e-sent-folder   "/sent"       ;; sent messages
  mu4e-drafts-folder "/drafts"     ;; unfinished messages
  mu4e-trash-folder  "/trash"      ;; trashed messages
  mu4e-refile-folder "/archive")   ;; saved messages

In some cases, having such static folders may not suffice — perhaps you want to change the folders depending on the context. For example, the folder for refiling could vary, based on the sender of the message.

To make this possible, instead of setting the standard folders to a string, you can set them to be a function that takes a message as its parameter, and returns the desired folder name. This chapter shows you how to do that. For a more general discussion of how to extend mu4e and writing your own functions, see Extending mu4e.

If you use mu4e-context, see Contexts and special folders for what that means for these special folders.