Spamassassin Junkmail and Notjunkmail Learning in Mountain Lion
Like many others <https://discussions.apple.com/thread/4181320?start=0&tstart=0>, I wondered what happened to spamassassin and its Bayesian learning mailboxes "junkmail" and "notjunkmail" in OS X Server. Perhaps Apple had automated this process? There certainly isn't any documentation. I didn't think much of it until spam began falling into my server's INBOX, whereupon looking for a fix I discovered that spamassassin learning capabilities still work in Mountain Lion OS X Server, but they aren't automated in any way.
Here's how to train your server to detect the junk mail you receive, beyond the appropriate spam filter and greylist settings Server.app>Mail.
First, confirm that your serveradmin settings know about the spamassassin Bayesian learning mailboxes "junkmail" and "notjunkmail":
sudo serveradmin settings mail:imap | grep junk
mail:imap:junk_mail_userid = "junkmail"
mail:imap:not_junk_mail_userid = "notjunkmail"
Then use Server.app to add the network accounts "junkmail" and "notjunkmail" and edit access so that these accounts only have access to the Mail service. Add these accounts to Mail so that you (and other trusted users) have access to them.
Then dump all your junkmail from your server accounts and other cloud email accounts into the "junkmail" mailbox. Move any messages that aren't junk but marked as such into the mailbox "notjunkmail".
Finally,
sudo /Applications/Server.app/Contents/ServerRoot/usr/libexec/spamassassin/learn_jun k_mail.sh
This will train spamassassin based on the content of these mailboxes, and hopefully you will begin to see amavisd properly mark junkmail as "** JUNK MAIL **" in the subject line.
Mac mini Server (Mid 2010), OS X Mountain Lion (10.8.2), Lion Server, EyeTV HD, Turbo.264 HD