Cron Job to Clear Out an Overstuffed Email Inbox (http://www.cpanelsupport.net/cron-job-to-clear-out-an-overstuffed-email-inbox/) Written by yolanda (http://www.blazonry.com/)
Topics: Email Tips (http://www.cpanelsupport.net/category/email-management/), General Tips (http://www.cpanelsupport.net/category/general-site-tips/)
You have an email inbox that is filled up. Or perhaps your "spam box" is filled up. You have so many emails to delete that it would take you forever to clear it out, page by page with NeoMail. One of my customers cried for help because of 35 MBs of spam that had accumulated.
It is time for drastic action. I say "drastic" because this cron job will delete all the emails in one fell swoop. And it will delete all emails that are in the email inbox everytime it runs. There is no recovery path for getting any of those emails back. Nonetheless, in some cases deleting all emails is justified. I use this with some accounts. I might be deleting real emails, but there is so much crap, that I feel it is worth it. Just so you know the downside of this cron job.
Here is the syntax for deleting all email in the inbox of the default email address for a website:
echo -n > /home/youraccount/mail/inbox Replace youraccount with your site login name (for example, the name you use to FTP to your site).
To determine the path to another email address, log into your site via FTP. Go to the mail directory (it is at the same level as public_html). Here you will see other email addresses as directory names. Click around, there might be subdirectories that you want to work with. To delete mail from a different email address, replace inbox above with the path you found while exploring via FTP.
Good luck. Happy email deleting. I think it feels good to blow away all that email. And I do it regularly for some accounts using this handy cron job.