Junk Mail Stuffed in Postbox

Bulk delete old emails in cPanel

Another handy script that I originally created in 2014, but updated to perform some sanity checks. This script will check for all files older than x months, or just targeting the junk emails, and permanently delete these emails.

To run this, just check within the code as examples are given here:

sh ./delete_old_emails.sh <user> <age in months> <junk>

Having the user set to all or * will run it for all users on the server. The third argument just needs to exist for it to target junk.

Leave a Reply

Your email address will not be published. Required fields are marked *