GICT knowledge base
How to Automatically Empty Trash Folder for Mails
Published
How to Automatically Empty Trash Folder for Mails
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.
Related guides
How to Test Application Emails with Mailpit
Capture staging emails with Mailpit over a private connection. Inspect message formats and attachments without confusing capture with real delivery.
EmailHow to Test SMTP Login and TLS with swaks
Diagnose SMTP connectivity, TLS and authentication with swaks. Protect credentials and distinguish server acceptance from recipient delivery.
EmailResolving: This message was classified as rSPAM and may not be delivered
Resolve InterServer rSPAM rejections using the SMTP code and MailBaby rule details. Check authentication, security and false positives through support.
EmailHow to Check SPF, DKIM and DMARC Using Message Evidence
Diagnose email authentication using real message identities and selectors, DNS answers and alignment instead of guessed records or delivery assumptions.
