> On 13/01/2025 18:25 EET Marc via dovecot <dovecot@dovecot.org> wrote:
> 
>  
> > >
> > >> 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.

You can use 

doveadm mailbox path INBOX

to get path to mailbox.

For some mailbox formats, you can use storageid to figure out the filename, 
e.g. maildir. For others, like sdbox, you can just deduce it from uid.

Aki

Aki

_______________________________________________
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org

Reply via email to