The deleted items are moved to trash folders, but they are not permanently deleted until the trash folders are emptied. However, the contents of these folders are consumed a large amount of space on your email server storage quota. You can set automatic removal of this folders from WHM.
1) Login to WHM as a root user.
2) Go to “Service Configuration”.
3) Select “Mailserver Configuration”.
4) Enable the option “Auto Expunge Trash”.
You can also choose how long you want deleted email to remain on the server if you want to automatically empty the trash folders. This can be done by using the option “Trash Expire Time”
5) Click the button “Save and exit”.
We can also set this via shell if this is a cPanel server with EXIM as MTA.
1) Open file /usr/lib/courier-imap/etc/imapd
# vi /usr/lib/courier-imap/etc/imapd
2) Set the parameter “IMAP_EMPTYTRASH” as:
IMAP_EMPTYTRASH=Trash:7
This would delete messages from the trash folder permanently after 7 days.