Autoexpunge not working for Junk?

Timo Sirainen timo at
Sat Jul 27 14:23:43 EEST 2019

On 25 Jul 2019, at 7.18, Amir Caspi via dovecot <dovecot at> wrote:
> Hi all,
> 	I set up dovecot a couple of months ago and am having trouble getting autoexpunge=30d to work on my Trash and Junk mailboxes.  Not sure why not because I'm not getting error messages in my log.
> 	Running "doveadm search -u <user> mailbox Junk savedbefore 30d" shows me many messages (I've got messages back to mid-May, and a couple of other users have them back to early April, although if this setting were working, there should be nothing earlier than June 24).  Running a manual doveadm expunge works fine... it's just autoexpunge that seems to not be running at all.

Autoexpunging tries to be efficient, so it looks only at the first email's saved-timestamp. It's also cached in dovecot.list.index. So you should check:

1. What's the first mail's saved-timestamp?
doveadm fetch -u user date.saved mailbox Junk 1

2. That timestamp should also be the same in dovecot.list.index:
doveadm mailbox status -u user firstsaved Junk

More information about the dovecot mailing list