How should I use 'doveadm search -u' to get the mailbox path where
the
message is stored? https://doc.dovecot.org/main/core/man/doveadm-search.1.html states:
doveadm-search(1) - Show a list of mailbox GUIDs and message UIDs matching given search query.
I don't see how the search command could be used to return some kind of "path".
As mentioned in the man page, use doveadm-search in combination with doveadm-fetch. To display the mailbox name and some headers (instead of fetching the entire message) use, for example:
doveadm search -u username [SEARCH PATTERN] | while read guid uid; do doveadm fetch -u username "mailbox hdr.subject hdr.date" mailbox-guid $guid uid $uid done
I can't remember what I did. I am not sure if this works with having multiple namespaces. I can remember just iterating of the mailboxes and searching them.