This how-to is useful if you have spamassassin and spambox enabled in cPanel.
We all know that this causes spam to be moved to a folder called "spam" that can be checked using an IMAP connection, or Horde's webmail interface, but some of us are too busy to delete these mails, and they DO take up space as well.
Some of us even have too many messages hitting this folder each day, so we don't have time to do it, right? Right.
Well, I've written yet another extremely short how-to for those of us who can't take the time to delete eleventy-billion spams from the spam folder each hour.
Your spamassassin and spambox must be enabled in cPanel.
Please note that the setup I'm about to explain will NOT save spam on your account for long, so keep in mind that if spam assassin marks a legitimate email as spam, then unless you happen to catch it before the actions I'm about to show occur, then that email will be lost. So, I'd recommend reading Danielle's How-to on training SpamAssassin before you partake of this fun and fantabulous journey.
I take no responsibility for legitimate emails that were marked by SpamAssassin being lost, if that happens. That being said, by reading this you agree to the terms and conditions as outlined by me at any given time. Shipping and handling is not included.
1. Ensure that SpamAssassin and spambox are enabled on your account. This can be checked in the Mail section of cPanel, under the "SpamAssassin" listing.
2. Ensure, and I mean ENSURE!!!, that SpamAssassin hasn't been catching legitimate emails sent to you. (As I stated, I recommend using Danielle's How-to on training SpamAssassin before you attempt this how-to.)
3. Log into cPanel.
4. Scroll down and click on "Cron Jobs".
5. You'll be presented with 2 buttons. For this How-to, we're using the "Standard" set. If you're really brave, and/or know Unix well enough, go for the Advanced.
6. You'll see a field stating "Please enter an email address where the cron output will be sent:" and a text box next to that. Enter your email address, or leave the account username there to have it email the default "catch all" account.
7. You'll see another text-field with "Command to run:" to the left.
In this box, enter the following command:
rm -f /home/your_account_username/mail/your_domain/your_email/spam
"your_account_username" = your cpanel username
"your_domain" = your domain, with no "http://" or "www."
"your_email" = your email address BEFORE the @. For example, my email address is "firstname.lastname@example.org". The entry would be "bob" without quotes.
So, if my account was bob2, this would be the command:
rm -f /home/bob2/mail/bobbywooo.com/bob/spam
If you're on one of the EMC servers, your path will need to be "/nfs/home/bob2/mail/bobbywooo.com/bob/spam" instead of just "/home/username".
8. Next, you'll see the "minutes, hours, etc." fields.
Skip "Minutes". Leave it at 0.
Set "Hour(s)" to (preferably) sometime in the AM, when the server load will be light, so as to make it easier on the server to process your removal.
Set "Day(s)" to a number higher than Every Day/1. Preferably every 2 days, even better if you set it to a higher number. This will keep your cron from causing any issues. Better safe than flooded with spam because the cron crashed itself.
Leave "Months" alone. It's fine where it is.
Set "Weekdays" to something that's NOT Every Weekday.
See the screenshot for an example using my account. The cron shown here will remove the spam folder from my "trey" account on my site. You'll want the setup to be similar. (Note: I'm on an EMC server, so I've got the /nfs in my path.)
9. Then click "Save Crontab".
Now when you go into the Cron Jobs section again, you'll see that the first one is filled out with the previous information.
You'll need to set one of these up for each mail account you want the spam removed for. It's not recommended to do with a large number of mail accounts.
OK, now you all owe me $20.