Re: What is the difference between BEFORE, SENTBEFORE, and SAVEDBEFORE?
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
On Thu, Jan 18, 2024 at 6:42 PM Joseph Tam jtam.home@gmail.com wrote:
If you dump the above values e.g.
doveadm fetch -ftab -A 'mailbox date.received' mailbox Trash BEFORE 90d
Correction: if what I suspect is true, this won't show you anything as all your messages will be younger than 90d. Instead, remove the "BEFORE 90d" condition and dump all values.
Joseph Tam jtam.home@gmail.com
participants (1)
-
Joseph Tam