Clean spam from mail folders


I run a few servers that do mail processing, and part of them is ASSP (http://sourceforge.net/projects/assp/). The result of this is that spam can be sent to separate e-mail accounts/forwards whose names are user-spam@example.org (where user@example.org is the original e-mail account).

Added to this the servers in question use virtual mailboxes for storing e-mail, with all mail under a common directory (name vmail, or mail, or something). The structure on our system the froxlor control panel (http://www.froxlor.org/) is mail/client/mailaccount, thus it is pretty easy to search.

The attached Perl script will search through all subdirectories which match a regular expression (default is to contain the word 'spam' in lower case) and remove older entries. Edit the block starting with Customize Here (put it in test mode by setting $TESTING to 1) and drop it into your /etc/cron.weekly. Set it to be executable and you are ready to go.

Last update:
2012-01-01 16:56
Author:
Rod
Revision:
1.2
Average rating:0 (0 Votes)

You can comment this FAQ

Chuck Norris has counted to infinity. Twice.