I have a couple of helper functions that determine the appropriate Archive folder based on message and sets mu4e-refile-folder accordingly. This relies on a simple heuristic (different accounts get filed into different Maildirs under Accounts) and I have a bunch of other stuff that sets the smtp stuff up per message as well. I should clean it up and publish it, but here are my functions to get you started:
(defun jfb/account-from-message-maildir (message)
"Given an mu4e-style 'message', return the account that this message belongs to, by examining the maildir into which it is filed. This is jfb specific and probably ought to be generalized, somehow."
(if (or (null message)
(not (mu4e-message-has-field :maildir message)))
(or multi-smtp/current-account
multi-smtp/default-account) ;; use the last account, if set.
(multi-smtp/valid-account-p (intern (downcase (car (split-string (mu4e-message-field-raw message :maildir) "/" t)))))))
(defun jfb/mu4e-folder-from-account (account folder-name)
(interactive)
(format "/%s/%s" (capitalize (symbol-name account)) folder-name))
(setq mu4e/archive-folder (lambda (msg)
(jfb/mu4e-folder-from-account
(jfb/account-from-message-maildir msg)
"Archive”))
> --
> You received this message because you are subscribed to the Google Groups "mu-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
mu-discuss+...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.