In cPanel & WHM version 104, we added a global spam auto-purge feature that will allow you to remove spam messages from all users’ Junk folders.
You can remove spam messages from all users’ Junk folders after a set number of days within WHM. This can be done by navigating to the following section within WHM:
- Service Configuration » Mailserver Configuration
- Once there, you will want to enable Auto Expunge Spam.
- Then you will want to navigate to Spam Expire Time. Here you can specify the total number of days the mail server stores messages in the Junk folder. The system will delete any messages that exceed this value.
Please note, that Dovecot will not clear existing mail in Junk folders until someone accesses their email account via IMAP or POP, logs into webmail, or when the user receives an email.