doveadm expunge didn't clear Trash mailbox
Joseph Tam
jtam.home at gmail.com
Tue Jul 24 23:12:05 EEST 2018
On Mon, 23 Jul 2018, Michael Wagner wrote:
> here works a dovecot 2.2.27 on a raspberrypi and the behaviour is as
> expected.
>
> doveadm -f tab fetch -u <user> "uid date.saved" mailbox Trash
> uid date.saved
> 314 2018-06-23 00:35:59
> 315 2018-06-23 12:39:10
> 316 2018-06-24 10:32:43
> ...
>
> And I have a cron script that expunges the mails older than 30 days.
> /usr/bin/doveadm expunge -u <user> mailbox Trash savedbefore 30d
Hi Michael,
Thanks for your observation. I think you probably use maildir format,
yes?
I think my problem stems from the fact I use mbox, so one file contains
many messages, whereas maildir uses one file for each message. Dovecot,
from my understanding, will use the message file's mtime for date.saved
if it doesn't have it in the cached. This is probably why I am seeing
multiple messages with the same value.
What's confusing is that if I query a message's date.saved, that
value -- whether from the cache or the mailbox's mtime -- remains
in the cache, so the next query will give me that value.
So running "doveadm fetch ... date.saved", will get the mailbox's mtime at
the time I fetched those values. In order to get near accurate date.saved
values, I would have to run "doveadm fetch ... date.saved" frequently.
(I think this behaviour must have changed recently because this no
longer works consistently.)
However, if each message is stored in a separate file (like maildir does),
then each message can have an accurate date.saved(=mtime). Once you
have accurate date.saved, then the "expunge savedbefore" works correctly.
Another reason I really ought to switch to maildir.
Joseph Tam <jtam.home at gmail.com>
More information about the dovecot
mailing list