Repopulating a bogofilter wordlist.db after corruption

So it had to happen eventually: My 660MB wordlist.db file got corrupted without any chance of recovering or repairing it. Having amassed a large amount of spam messages in an mbox file called “spam” during bogofilter’s operation, it’s quite easy to repopulate the wordlist using the “formail” command:

$ formail -ds sh -c 'cat  | bogofilter -s ' < spam

This operation may take a while depending on your spam mailbox size and your disk speed, but it should set you up quickly with bogofilter in a working state.

It’s also advisable to check the spam mailbox for false positives *before* feeding it to formail to reduce the chance or legit mails ending up in your spambox due to false flagging by bogofilter.

 

Leave a Reply

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