To setup MacOS Mail.app 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.
Since Mail.app 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)...
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.
OK button to create it.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...
Mail menu, select PreferencesRules button in the toolbar, then click
on the button labelled Add RuleDescription.
From, and
select the final option, Edit Header List...
Message Headers),
click
to add
a header.X-Spam-Level in the Header: box then
click the OK button to return to the rule specification sheet.
is equal toYES (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.
Move Message and set the destination
to be the spam folder you created (in this example we use the Junk
folder).