Mu4e documentation has an example of smart refiling, whereby you can choose which maildir to refile an email based on the properties of that email. I'd like to do that, except the destination maildir's name is a property of the email (specifically the :to property).
Probably easiest to explain in an example. In the documentation:
(setq mu4e-refile-folder (lambda (msg) (cond ;; messages to the mu mailing list go to the /mu folder ((mu4e-message-contact-field-matches msg :to "email@example.com") "/mu") ;; ........[ SNIP ] )))
In this example all emails to a googlegroups
firstname.lastname@example.org end up in the
/mu maildir. I'd like to go one further. I'd like
%email@example.com to go to the maildir
/googlegroups/%anything%, for any value of