From: Paul Pace paul@mostlybsd.com
BEFORE date specification Matches messages with an internal date before date
specification.
SENTBEFORE date specification Matches messages with a Date: header before date specification. SAVEDBEFORE date specification Matches messages, which were saved before date specification.
I am creating a cron job to purge old messages in Trash or Spam folders, but I discovered using doveadm search queries using savedbefore that somehow no message in any of the folders shows up with queries starting at 5d, even though there are much older messages.
I don't know exactly the answer to your query, but the semantics of each term may not be the problem. I had this exact problem a decade ago with my own trash purging script.
If you dump the above values e.g.
doveadm fetch -ftab -A 'mailbox date.received' mailbox Trash BEFORE 90d
you may find that many of them have the same value, and what's more, the time coincides with the first time you queried for that value (i.e. when you ran the above doveadm fetch). I think these fields may not have cached values before you ask for it, then it gets instantiated the current timestamp when you do. If you do a fetch every day, you'll eventually reach 90d, and it will work forever more (+/- 1 day).
Perhaps adding those fields into these settings is a more direct and better solution:
https://doc.dovecot.org/configuration_manual/mail_cache_settings/
Joseph Tam jtam.home@gmail.com