This is a bit time consuming...but the only way I know of to do this is with zmmboxsearch
Code:
zmmboxsearch -d /tmp/somedir -m account@domain.com -l25000 -q "in:\"Inbox\""
This will dump (-d) the messages that match the query (-q) for the mailbox (-m) with a limit of 25000 results returned.
From there, you will have all the messages in the /tmp/somedir that will be named:
Sequence#_uuid_messageid
So, if you were able to fine-tune the problems with the search, you will have all the message ids to get rid of. Otherwise, you will have all messages that you can then go through w/ normal command-line tools, and then make a list of the message IDs that you want to get rid of.
From that you can then use zmmailbox to operate on the specific message ids. So, if you want to remove items, you can do:
Code:
zmmailbox -z -m account@domain.com di itemid itemid itemid