Recently, I needed to look at the message sources referenced by message ID within the maillog.  Dovecot does not directly reference the message ID within the filename.

Knowing the mailbox user, using the doveadm utility, I was able to search the user’s messages for the matching message ID, which provided two space delimited fields: the mailbox-uid and message uid. From within the user’s Maildir:

doveadm search -u 'user@domain.ca' HEADER Message-ID '<message-id-here>'

Given this info, I was able to lookup the message filename using the message uid as a search key. The ‘dovecot-uidlist’ file matches the message uid with the message filename.

cat dovecot-uidlist | grep 'uid'

And that will tell you the filename.