Spam filtering with Apple

Users of Apple's can use the Lab's SpamAssassin installation score their e-mail and then use's filter rules to remove spam.

To setup MacOS to filter mail using the header information added by the SpamAssassin service you need to do two things. First, you must create a folder into which suspected spam messages will be transferred. And second, you must create a filter rule which will check the Spamassasin headers and perform the filtering.

Create the Spam folder

Since has its own Spam mail filtering system, you may already have a mailbox (usually named "Junk") into which suspected spam could be filtered. If this folder does not exist, then you must create it.

To create a folder to hold suspected spam (assuming that you don't have one already)...

  • In the Mailbox menu, choose the New Mailbox... command.

A dialogue box will appear that contains a field allowing you to name the new mailbox, and pop-up menu allowing you to specify where the mailbox should be created - on your local machine or on your staffmail account (there may be other options available if you have more email accounts). It's recommended that you don't use a mailbox on your local machine - at least until you are happy that the filtering is working correctly.

  • Once you've selected a location for the mailbox, and named it, and click on the OK button to create it.
Creating a filter to deal with suspected spam

You need to create a filter which will check whether messages are likely to be spam. This filter will work by checking for information added to the message headers by the SpamAssassin service. Specifically you will be checking the value of the X-Spam-Flag header.

To create the filter...

  • In the Mail menu, select Preferences
  • Click on the Rules button in the toolbar, then click on the button labelled Add Rule
  • A sheet will drop down from the Rules window which allows you to set up the new rule.
  • Give the rule an appropriate name by typing in the field labeled Description.
Add rule menu
  • Click on the pop-up menu currently labeled From, and select the final option, Edit Header List...
Message Headers
  • In the window that appears (entitled Message Headers), click to add a header.
  • Enter X-Spam-Level in the Header: box then click the OK button to return to the rule specification sheet.
Finish Rule
  • Now you must set the adjust the condition dialog boxes for the new header to be is equal to
  • Finally, enter the value YES (all capitalized)

Now that you have told the rule which messages to select, you use the pop-up menus on the lower part of the sheet to tell the rule what to do with these messages.

  • Set the dialog boxes to Move Message and set the destination to be the spam folder you created (in this example we use the Junk folder).
  • Click the OK button at the bottom of the Rules sheet. This rule will now become active. Close the Rules window.