How to Automatically Empty Trash Folder for Mails

Last modified: July 26, 2020
You are here:
Estimated reading time: 1 min

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”.

Empty Trash Folder

 

3) Select “Mailserver Configuration”.

Empty Trash Folder

 

4) Enable the option “Auto Expunge Trash”.

Empty Trash Folder

 

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.

Was this article helpful?
Dislike 0
Views: 107