cPanel & WHM Version 114 has been released, and brings a slew of great updates. Take a look at what is included, and then upgrade today!

Automatically delete email messages older than 30 days from all server accounts in the spam and tras

JGBRLABS shared this idea 3 years ago
Open Discussion

As a webhosting provider, I would like for emails in the spam or trash folders to be automatically deleted every 30 days to avoid having junk mail taking up space.


As a provider we know that most users do not usually delete messages from spam folders, trash. It would be very interesting to have some native option within WHM that allows this to be done automatically by creating some rules.

For example:

Delete all emails from the "spam", "trash", "junk" folders with "more than 30 days".

I created a command as below, but I didn't get to test it, it would do what I mentioned above.

find /home/*/mail/*/.spam -type f -mtime +30 -exec rm -f {} \;
However, I would find it interesting to implement this idea natively within the WHM. As a provider, we would save a lot of disk space with this feature.

Thank you!

Leave a Comment
Attach a file