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:
msg
parameter you receive in the function refers to the
original message, that is, the message being replied to or forwarded.
When re-editing a message, it refers to the message being edited. When you
compose a totally new message, the msg
parameter is nil
.
mu4e-drafts-folder
is ignored.