Tools to get a report of which folders have new mail?

Oscar del Rio delrio at
Wed Jul 20 20:26:17 UTC 2022

On 2022-07-18 11:18 p.m., Steve Litt wrote:
> I use a Dovecot IMAP server on my Linux desktop computer, and I'm
> pretty good at writing shellscripts. Is there any way I could use
> doveadm or other tools to create a report that shows all my folders in a
> hierarchy? Also, is there a way to show only those with new mail?

you could use "doveadm mailbox list" to build the list of folders and
"doveadm search" to search each folder for appropriate IMAP flags

doveadm mailbox list -u username | sort
doveadm search -u username mailbox foldername UNSEEN
(or NEW instead of UNSEEN)

More information about the dovecot mailing list