Previous: , Up: Dynamic folders   [Contents]


10.2 Other dynamic folders

Using the same mechanism, you can create dynamic sent-, trash-, and drafts-folders. The message-parameter you receive for the sent and drafts folder is the original message, that is, the message you reply to, or forward, or edit. If there is no such message (for example when composing a brand new message) the message parameter is nil.

Let’s look at an example. Suppose you want a different trash folder for work-email. You can achieve this with something like:

(setq mu4e-trash-folder
(lambda (msg)
;; the 'and msg' is to handle the case where msg is nil
(if (and msg
(mu4e-message-contact-field-matches msg :to "me@work.example.com"))
"/trash-work"
"/trash")))

Good to remember: