Why do I see incorrect results in Webmail or IMAP mail searches?

This page is showing a generic answer.
To see a more detailed answer customized for you, type your e-mail address here:

We've occasionally heard of problems where Webmail (or any other IMAP mail program) shows incorrect search results or other glitches, especially if you have tens of thousands of messages in a folder. For example, it might only show the most recent few results.

If this happens to you, the IMAP message “cache” on the server may contain incorrect information. You can contact us to fix this, or, if you’re comfortable with the SSH shell, login and type imap-cache-reset address@example.com.

This will completely delete all IMAP caches and indexes on the server, too. Then you can try the instructions above again.

(Doing this does not delete any useful data. It merely makes the next IMAP connection somewhat slower as the individual messages are inspected to rebuild the cache files.)

Is there any way technically advanced users can test the mail indexes to see if this is the problem?

Technically advanced users can mimic an IMAP search from the command-line shell. This can help show whether this is the problem or not. SOme examples will describe the syntax:

doveadm search -u address@example.com mailbox INBOX FROM address
doveadm search -u address@example.com mailbox INBOX.Sent SUBJECT searchword
doveadm search -u address@example.com mailbox INBOX.Trash TEXT searchword

The doveadm-search-query manual page shows more details.