Same setup here and same problem here too!
I could swear, that with the first installation of Mailcow (version 2023-05 or 2023-05a) i had this setup working. I still see the used subfolder of that inbox with it’s test eMail.
After updating straight from that initial installed version to actual (2023-08) it stopped working. Tried to investigate a little bit and verified the Global Postfilter but couldn’t see any change here.
Maybe there’a a regression and the used alias user+foo@example.com gets resolved to user@example.com, so the filter can’t see the tag “+foo” and won’t sort it into the correct folder, or more likely the “to” header doesn’t contain the needed “X-Moo-Tag”, which would explain the always matching code change to work.
eMails which are processed correctly, do show the “to” address as user+foo@example.com and the unprocessed/unfiltered ones show the used alias address. I’m leaning towards my idea of an introduced regression (see above).
Albeit a working solution is great – thanks for posting it – i would prefer to have the problem fixed upstream, so any further updates don’t break anything later on (to forget a manually made change is human after all) 😁.
I do have another eMail system waiting here, which would make heavy use of aliases which point to tagged addresses – there’s simply no way of forcing the senders (alot different ones) to use new email addresses.
Thx.