doveadm expunge -u <user> mailbox '*' savedbefore 30d
That doesn't work for me either. The command is accepted, but the messages are not expunged.
I guess my search/fetch will just have to return the mailbox name, in addition to other fields, and then I'll need to loop through the mailbox names and perform multiple expunges for each user. I understand the desire to avoid accidents by requiring that the mailbox be specified. But if "mailbox ALL" or "mailbox '*' were allowed, that would still avoid the accident and yet also avoid the inefficiency of having to perform multiple expunges for one user.
*** Enhancement request: provide a "mailbox all" or "mailbox '*'" option for doveadm search_query so that expunge can be used to remove mail without regard to which mailbox it's in.
Are you sure you really want to do this? My server expunges Trash and Junk on a cycle, but reaching into other mailboxes seems iffy.
Yes. I understand it's unusual. This is an RF (radio) application for emergency services. We have to be efficient about channel utilization. Users know they need to keep their mailboxes clean so that, at the start of an emergency (or other incident), the channel is not clogged with downloading lots of old, irrelevant mail. If they haven't logged in for a while, we'll keep it clear for them.
Michael