I decided to sit down and write a script that will wipe out the spam tables and recreate them from the exim files.
Note: The code in these files are taken from existing mailcleaner files. It's not the cleanest most efficient way but it works.
What it will do...
1. Stop mail flow by stopping exim stage 1.
2. Repair all of the databases. (This appears to be necessary before the tables can be dumped.)
3. Backup the spool database to /root/mc_spool_yymmdd.tar.gz.
4. Wipe out the current spam tables.
5. Rebuild the spam tables by scanning the exim files for each user of each domain and gather the sender, subject, spam score, time and date, and running all of this back into the master & slave databases.
6. Restart exim stage 1.
All of this is logged to /root/repair_yymmdd.log for your review.
What it wont do...
1. This will NOT put the released messages back in the database. These are deleted when released so there is no way to recreate what isnt there.
2. Do your laundry!
Note: There appears to be an issue where the quarantine reasons are not put back properly. The scores are accurate but the reasons why are not complete.
How to do it...
1. Download the attached file and extract it to /usr/mailcleaner/bin (You can probably run it from other locations but I havent tried that yet.)
2. Install a perl file by running
Code: Select all
aptitude install libtime-format-perl
3. Run rebuild_spam_db.sh
4. Sit back and wait. If you have lots of spam from lots of users over lots of domains this can really take a while.