doveadm search prints the UIDs of messages matching the given search, here unread subject lines in INBOX. It runs the same search engine as IMAP SEARCH. Follow up with doveadm fetch to read the raw message of a found UID.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.