Remove All Spam and Trash from Server

A buildup of spam and trash in user accounts can occupy several gigs worth of space. To easily remove spam and trash from your users’ accounts, you can use the following commands:

Maildir/Courier-IMAP:

rm -rf /home/*/mail/*/*/.spam/*
rm -rf /home/*/mail/.spam/*
rm -rf /home/*/mail/*/*/.Trash/cur/*
rm -rf /home/*/mail/*/*/.Trash/new/*

CPPOP:

rm -rf /home/*/mail/*/*/spam
rm -rf /home/*/mail/spam
rm -rf /home/*/mail/INBOX.Trash
rm -rf /home/*/mail/*/*/INBOX.Trash

To delete the cPanel trash folders:

rm -rf /home/*/.trash/*

Leave a comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.