Every once in a while, I find the need to do some manual training of my SpamAssassin Bayes database using sa-learn. I use Thunderbird as my mail client and there was no easy way to get the messages in an mbox format to perform the training.
What I had been doing was opening Evolution when I needed to do this, highlighting the messages, right clicking and selecting "Save As". This would save it out as an mbox type file.
This process was always a hassle for me. If I moved to a new laptop, I had to set up Evolution again.
The guys over on the
SpamAssassin users list pointed something out. If Thunderbird is set up correctly, each folder is stored in the mbox format!! I don't need Evolution any more!!
The first thing that needs done only applies if your email is stored on an IMAP server. By default, Thunderbird only keeps the header information and the actual message stays on the server. This doesn't help because no mbox file is created.
If you have a particular folder that you keep Spam in, simply right click the folder and hit properties. On the "Offline" tab, check "Select this folder for offline use." Go ahead and click the "Download Now" button.
You should now have all the messages in that folder in the mbox format. The hardest part to this is finding it. You need to find where Thunderbird is storing your IMAP mail. On Ubuntu Gutsy, mine was located at ~/.mozilla-thunderbird/ib2f15lc.default/ImapMail. I have multiple user accounts set up and finding the next directory is a little harder.
You can search out the files by the folder name. So if you are keeping your junk messages in a folder called "Junk-Mail", that will also be the name of the file. Find it like this:
$ find ~/.mozilla-thunderbird/ib2f15lc.default/ImapMail -name "Junk-Mail"
The problem is if you have multiple accounts and they each have the same folder name. As it's a text file, you can crack it open and probably figure out which one you are looking at. Another easy way to tell is if the folder structure is different for each account, you see those folder names with ".msf" following them. You'll know you are in the right place.
Once you find the file, simply copy it off and perform whatever sa-learn routine you use!
Craig Deering
Network Engineer
Astro Shapes, Inc. -
Aluminum ExtrusionsWebsite -
http://www.astroshapes.com