Skip navigation

Spamassassin Junkmail and Notjunkmail Learning in Mountain Lion

5386 Views 34 Replies Latest reply: Nov 14, 2013 10:56 AM by scottl31 RSS
1 2 3 Previous Next
essandess Level 1 Level 1 (0 points)
Currently Being Moderated
Nov 4, 2012 2:40 AM

Like many others <>, 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>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 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".




sudo /Applications/


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
  • Kostas B Level 1 Level 1 (90 points)

    This is great info, thanks for sharing.


    2 questions:


    1. How do you set this accounts as "public folders"? Or you just instruct users to add these accounts in their Mail client?

    2. Does "learning" and removing false spam marking really works?


    Best regards



  • Jeff Hargrove Level 2 Level 2 (235 points)



    I discovered this post and tried the command you suggested for training junkmail, however I got an error message instead:


    server:~ admin$ sudo /Applications/


    grep: /Applications/ No such file or directory

    Can't determine mail store path from /Applications/


    How can I fix this?





  • Jeff Hargrove Level 2 Level 2 (235 points)

    Yes, I did fix the typo.


    However following your commands, I still get an absent partition_map.conf file:


    server:~ admin$ ls -l /Applications/

    ls: /Applications/ No such file or directory

    server:~ admin$ ls -l /Library/Server/Mail/Config/dovecot/partition_map.conf

    -rw-r--r--  1 root  admin  39  7 nov 08:22 /Library/Server/Mail/Config/dovecot/partition_map.conf

    server:~ admin$ cat /Library/Server/Mail/Config/dovecot/partition_map.conf


    server:~ admin$


    Is it the same file in both locations? Can I copy it into /Applications/ ?

  • Jeff Hargrove Level 2 Level 2 (235 points)

    haha, Yes I agree. With each clean installation, nothing is the same!


    Well it seems to have worked! Does this look right to you?


    server:~ admin$ sudo /Applications/

    Learning what is junk mail

    --- sudo -u _amavisd /Applications/ --dbpath /Library/Server/Mail/Data/scanner/amavis/.spamassassin --spam --no-sync < /Library/Server/Mail/Data/mail/45D0C5F6-DBC3-48A0-AAF9-7D69F79E0FEC/cur/1352283,S=50277,W=50949:2,Sa

    --- sudo -u _amavisd /Applications/ --dbpath /Library/Server/Mail/Data/scanner/amavis/.spamassassin --spam --no-sync < /Library/Server/Mail/Data/mail/45D0C5F6-DBC3-48A0-AAF9-7D69F79E0FEC/new/1352293,S=49035,W=50239

    --- sudo -u _amavisd /Applications/ --dbpath /Library/Server/Mail/Data/scanner/amavis/.spamassassin --spam --no-sync < /Library/Server/Mail/Data/mail/45D0C5F6-DBC3-48A0-AAF9-7D69F79E0FEC/new/1352308,S=6250,W=6422

    --- sudo -u _amavisd /Applications/ --dbpath /Library/Server/Mail/Data/scanner/amavis/.spamassassin --spam --no-sync < /Library/Server/Mail/Data/mail/45D0C5F6-DBC3-48A0-AAF9-7D69F79E0FEC/new/1352371,S=1362,W=1391

    --- sudo -u _amavisd /Applications/ --dbpath /Library/Server/Mail/Data/scanner/amavis/.spamassassin --spam --no-sync < /Library/Server/Mail/Data/mail/45D0C5F6-DBC3-48A0-AAF9-7D69F79E0FEC/new/1352495,S=16231,W=16452

    --- sudo -u _amavisd /Applications/ --dbpath /Library/Server/Mail/Data/scanner/amavis/.spamassassin --spam --no-sync < /Library/Server/Mail/Data/mail/45D0C5F6-DBC3-48A0-AAF9-7D69F79E0FEC/new/1352495,S=19331,W=19592

    --- sudo -u _amavisd /Applications/ --dbpath /Library/Server/Mail/Data/scanner/amavis/.spamassassin --spam --no-sync < /Library/Server/Mail/Data/mail/45D0C5F6-DBC3-48A0-AAF9-7D69F79E0FEC/new/1352495,S=13378,W=13563

    --- sudo -u _amavisd /Applications/ --dbpath /Library/Server/Mail/Data/scanner/amavis/.spamassassin --spam --no-sync < /Library/Server/Mail/Data/mail/45D0C5F6-DBC3-48A0-AAF9-7D69F79E0FEC/new/1352495,S=13001,W=13180

    Learning what is not junk mail

    find: /Library/Server/Mail/Data/mail/5A73D415-CF7B-4C2F-AAEF-FF2F8536493E/cur: No such file or directory

    find: /Library/Server/Mail/Data/mail/5A73D415-CF7B-4C2F-AAEF-FF2F8536493E/new: No such file or directory


    I don't like the last two lines, though!

  • Jeff Hargrove Level 2 Level 2 (235 points)

    Great! Thanks for your help!


    Ok, this is weird ... I tried those commands and I'm getting no such file or directory response! Should I be worried?

  • Jeff Hargrove Level 2 Level 2 (235 points)

    I didn't do much, but was glad I could help a little after all the help you gave me!


    By the way, could the absence of that symbolic link affect spam being quarantined to a mail box? I'm having an issue where spam is not quarantined to the address I gave it.

1 2 3 Previous Next


More Like This

  • Retrieving data ...

Bookmarked By (1)


  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.