Email Deleted/Archived But Still Showing in Space Usage – Cpanel/Dovecot

Synopsis

Your customer has deleted the emails using Outlook/Imap client or may have archived them on their PC. But the space usage didn’t change in your Cpanel counterpart. What do to?

Solution

The issue arises because Dovecot Imap does soft delete when issuing delete command. They don’t necessarily get deleted, instead marked for expunge. You need to issue the expunge/purge command to get the storage cleared. In Cpanel, they usually do it on the daily upcp command they run. But if you are not running upcp daily, or would like to voluntarily do this, you can do this by running the following command:

/scripts/dovecot_maintenance

If you do not run upcp daily, then you can run the above command using a cron, daily to make sure IMAP deletions are expunged daily to reclaim storage.

The above command expunges all the accounts that require expunge. But if you want to expunge any single account, you may do so using the following command:

doveadm purge -u [email protected]

Replace [email protected] with the email address that has issued the deletes.