Many a times it happens that the mails under the cPanel accounts consume lot of the disk quota.

The problem became significant if you are managing a shared server or your are a re-seller, as you do not have control over each and every e-mail account.

Clients too some times are not aware about the simple fact that mails gets stored in trash folder even being after removed from inbox..

In such scenario the simple solution is to have a setting on the server which will automatically remove the mails from all the E-mail account’s trash folder after specific amount of time.

Well if this is sounds attractive.. lets figure out how to achieve this on the cPanel server with EXIM as MTA.

Check the IMAP configuration file ” /usr/lib/courier-imap/etc/imapd “ it has this setting

vi /usr/lib/courier-imap/etc/imapd

look for the parameter ” IMAP_EMPTYTRASH “ here

The following setting is optional, and causes messages from the given folder to be automatically deleted after the given number of days.
IMAP_EMPTYTRASH is a comma-separated list of folder:days.


This would delete messages from the Trash folder (presumably delete e-mail) after 7 days. This is a global setting that is applied to every E mail account, and is probably useful in a controlled, corporate environment.

Important Fact :: – the purging is controlled by CTIME, not MTIME (the file time as shown by ls). It is perfectly ordinary to see stuff in Trash that’s a year old. That’s the file modification time, MTIME, that’s displayed. This is generally when the message was originally delivered to this mailbox. Purging is controlled by a different time-stamp, CTIME, which is┬áchanged when the file is moved to the Trash folder (and at other times too).