OK, so I had a look in to Sieve and filters, but it seems this functionality is already implemented there, because there is a global Postfilter that, if I am reading it correctly (and this is the first time I have ever looked at Sieve syntax, so I might not be) already does the moving to sub folders based on the tag:
if allof (
envelope :detail :matches "to" "*",
header :contains "X-Moo-Tag" "YES"
) {
set :lower :upperfirst "tag" "${1}";
if mailboxexists "INBOX/${1}" {
fileinto "INBOX/${1}";
} else {
fileinto :create "INBOX/${tag}";
}
}
I didn’t add that, so I am guessing it is added by selecting the tag\subfolder option in the UI?
But if that’s the case, this isn’t firing for Address rewriting\BCCd eMails.