Allow me to bump this thread. I believe there is a bug somewhere. Either in the code, or in the documentation.

On 18 May 2023 21:13:50 CEST, "Léo El Amri via dovecot" <dovecot@dovecot.org> wrote:
Hello there,

When using the doveadm command (search HEADER "X-Discourse-Post-Id" "") or the IMAP command (SEARCH HEADER X-Discourse-Post-Id ""), emails containing a X-Discourse-Post-Id header are not listed.

I've also tried with non X- headers, such as List-Unsubscribe and Auto-Submitted.

RFC 3501 [1] and Dovecot's documentation [2] both says that this command should return emails containing the header searched.

I couldn't find a mention of this bug in the git history, hence why I'm posting here, maybe there is something wrong with my installation ?

I'm running Dovecot 2.3.20 on Debian on amd64 with an ext4 filesystem. I attached the output of dovecot -n.

[1]: https://www.rfc-editor.org/rfc/rfc3501.html#section-6.4.4
[2]: https://wiki.dovecot.org/Tools/Doveadm/SearchQuery