Using Spamassassin and Mozilla

I’ve seen this asked a few times here and there. So here it is.

Open Mozilla Mail&News and go to the “Tools” menu and select “Message Filters…”. You should be brought a window llke this:

Message Filters

Select the email address you wish to filter for, and press the “New” button to the right. You will then see a window like this:

Filter Rules

Give the filter a name, such as “SpamAssassin”, or “spamfilter”, or whatever floats your boat and helps you sleep at night. Then pull down the first menu and select “customize” on the very bottom. We need to teach Mozilla about Spam Assassin’s special header for detecting spam.

Every email contains what are known as “headers”, these are a few lines of what most consider “jiberish”, but contain routing information, and some tagging by various systems when sending/receiving email. Lets teach it to recognize the “X-Spam-Flag” header, created by spamassassin. In the window shown below, enter the header, and create it as shown:

Customize Header

Say “OK”, and close that. Now we are back to that Filter Rules page. Go to the first column again, and pull down. Now you will see our new header we added on the end of the list. Select it. That’s what we want to check. It’s spam if it’s set to “Yes”, so make the rule say “X-Spam-Status” “contains” “Yes”.

Then on the bottom half of the window, we need to tell Mozilla what to do with all mail that matches the rule. I like to have it sent to a junk folder (as shown below). You can customize any of those below to do what you want. Delete (not recommended, since you can’t check to ensure it’s spam), move, notify, mark, etc.).

Filter Rules

That’s it. Not too hard. The above is mostly images, and much more detailed than most really need. Just take your time.

2 thoughts on “Using Spamassassin and Mozilla

  1. I just want to add that the above instructions are virtually identical to filtering in Mozilla Thunderbird ( http://seb.mozdev.org/thunderbird/ & http://www.mozilla.org/products/thunderbird & http://www.mozilla.org/projects/thunderbird/ ) in addition to the Mozilla Mail&News you describe (which is not surprising as they are siblings). Screen shots and custom headers work and look the same.

    My only suggestion is that people create a subfolder under their “Junk” folder called “SpamAssassin Junk” or something similar (“whatever floats your boat and helps you sleep at night” 🙂 and filter SpamAssassin junk to that folder. Then you can let the Bayesian filtered spam that Mozilla catches itself that SpamAssassin misses go to the Junk folder as it is usually set to, and then you’ll know how much mail each filter is catching and if you have SpamAssassin attach the original message you’ll have the “spam description” versions in the SpamAssassin Junk folder and the non-altered Mozilla catches in their own folder.

    Just my two cents to Robert’s excellent tutorial.

  2. Misleading title. This just explains how to write a filter in mozilla/thunderbird for an email already run thru spamassassin, rather than how to actually use spamassassin with mozilla.

Leave a Reply

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