Auto Expunge Trash, actually is not expunging anything

Kent Brockman

Well-Known Member
PartnerNOC
Jan 20, 2008
1,255
60
178
Buenos Aires, Argentina
cPanel Access Level
Root Administrator
Hey guys, I'm worried about this feature not working at all. Since a lot of time, actually. I've failed to report this in the past, but it is becoming a problem on servers with thousands of email accounts alotting gigs of trash.

Below is the current configuration in all the servers, but it is quite being ignored and no Trash folder is being currently processed. I found trashed mails from more than 6 months...

autoexpunge trash cpanel.png

Any solution or debug action to enable the auto expunge for real?
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,252
313
Houston
Hi @Kent Brockman

So this should be part of the nightly maintenance that runs. One of the items that is run during maintenance is
Code:
/scripts/dovecot_maintenance
And that script includes the auto expunge:

Code:
dovecot_maintenance - Run nightly maintenance for dovecot which includes
                      expunging trash and purging deleted messages from
                      mdbox.
There are some caveats like mail that was in the trash prior to enabling auto expunge will not have an expiration added and as such will not be auto expunged, there is also some issue with mail directly filtered to trash using an email filter.

There are a few other threads referencing the same issue as well:

Delete all emails in Trash via SSH
SOLVED - Dovecot trash not deleting

Can you confirm that your mail doesn't meet any of the conditions and/or are there any notifications when you run dovecot maintenance manually?

Thanks!
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,252
313
Houston
Hi @Kent Brockman

To look more in-depth on this I'd like to see what you have when you do the following -

First, identify the mail in trash with an expiry time - the last entry is an epoch date for when the mail was delivered :

Code:
# sqlite3 /var/cpanel/dovecot/dict.sqlite
SQLite version 3.7.17 2013-05-20 00:56:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
expires
sqlite> select * from expires;
[email protected]|INBOX.Trash|1539182250
You can translate that into a standard date with the following:

Code:
# date -d @1539182250
Wed Oct 10 09:37:30 CDT 2018
Add 30 days to that and you will have the date the mail should be deleted automatically.



Thanks!