Mac OS X Mail and the Junk Filter

If you access your IMAP mailbox with Mac OS X Mail as well as some other clients, you may want to use the DreamHost junk filter using SpamAssassin as well as the junk filter in Mail.


 * In Mac OS X mail, set a mailbox on your DreamHost account to be your junk mail folder.
 * In the Junkmail settings for your DreamHost mailbox, set "Quarantine to IMAP folder?" to the name of the same mailbox that you use for junk mail in Mail, and "At what spam score should emails be tagged as spam?" to some good number (4?).

Now junk mail identified by SpamAssassin on DreamHost will be found in the junk folder, but Mac OS X Mail will not automatically recognize it as junk mail.

To make it do that, save this AppleScript:

tell application "Mail" set m to every message in mailbox "Junk" of account "DreamHost" whose junk mail status is false repeat with eachMessage in m         set junk mail status of eachMessage to true end repeat end tell

Then create a launchd job (for instance with Lingon) that runs this script regularly.