6 Replies Latest reply: Mar 18, 2013 2:13 PM by Munger1
Munger1 Level 1 (0 points)

Having trained my spam filter, I find that spamassassin is correctly identifying over 95% of junk mail, and is marking it as such by rewriting the subject. However, it is still being delivered to my inbox despite having the following settings :-


mail:postfix:spam_quarantine = "spamcop@mydomain.com"

mail:postfix:spam_subject_tag = "***JUNK MAIL*** "

mail:postfix:spam_notify_admin_email = "spamcop@mydomain.com"

mail:postfix:black_hole_domains:_array_index:0 = "zen.spamhaus.org"

mail:postfix:spam_scan_enabled = yes

mail:postfix:virus_quarantine = "spamcop@mydomain.com"

mail:postfix:spam_rewrite_subject = yes

mail:postfix:virus_notify_admin_email = "spamcop@mydomain.com"

mail:postfix:spam_notify_admin = no

mail:postfix:spam_action = "deliver"


Do I need to change mail:postfix:spam_action or some other setting to have the junk sent to spamcop@mydomain.com instead of the user's inbox? Even better would be a global setting to send the spam to each user's 'Junk' folder, but for now a global quarantine account is fine.


**** UPDATE ***

I just checked in /Library/Server/Mail/Config/amavisd/amavisd.conf and find that the relevant lines are commented out. I could edit this manually, but suspect that some other setting is required to  enable these. Any ideas?


#$virus_admin              = 'spamcop@mydomain.com';  # notifications recip.

#$spam_admin               = 'spamcop@mydomain.com';

#$spam_quarantine_to       = 'spamcop@mydomain.com';

#$banned_quarantine_to      = 'spamcop@mydomain.com';

#$virus_quarantine_to      = 'spamcop@mydomain.com';

iMac, OS X Server, Mountain Lion Server 10.8.3
  • UptimeJeff Level 4 (3,445 points)

    You are looking in the right place.


    There are 3 levels of action


    low-score:  delivered to inbox

    med-score:  default is **JUNK MAIL** added to subject and still delivered to your inbox

    high-score:  can be discarded or quarantined (and other options available)

    sky-high-score:  setting is optional, if mail hits this level then its not quarantined


    What I like to do is enable + addressing and set it up like this:


    low-score: delivered to user inbox

    med-score:  delivered to user's Junk folder (not their inbox)

         this allows the user to scan their junk)

    high-score: either discard or route to a quarantine account

    sky-high: always discarded


    You can tweak these levels in amavisd.conf


         less than tag2 level is a low score

    $sa_tag2_level_deflt = 3.5;

         between tag2 and kill_level_deflt is medium

    $sa_kill_level_deflt = 6.5;

         above kill_level_deflt is high

    $sa_quarantine_cutoff_level = 18;

         and above quarantine_cutoff is sky-high


    $final_spam_destiny = D_DISCARD;

    In example above, this causes mail which is 6.5+ to be discarded and not delivered to the user

    unless it hits 18 (always discarded at 18+ based on above settings)


    To enable the medium level to automatically be placed in the Users Junk folder, make these changes adjust these in amavisd.conf

    @addr_extension_spam_maps = ('Junk');

    $recipient_delimiter = '+';


    And you'll need to enable plus addressing, to do so edit:


    You will find a line about plus addressing in dovecot. You comment this one:

    flags=DRhu user=_dovecot:mail argv=/Applications/Server.app/Contents/ServerRoot/usr/libexec/dovecot/dovecot-lda -d ${user}

    And uncomment this one:

    flags=DRhu user=_dovecot:mail argv=/Applications/Server.app/Contents/ServerRoot/usr/libexec/dovecot/dovecot-lda -d ${user} -a ${recipient} -m ${extension}

    Stop/start mail.


    Make sure each user has a folder named 'Junk' (case sensitive)

    Now medium score should land in their Junk folder.

    This works great for iOS devices, they don't have to see ***Junk*** in their inbox anymore




    hope that helps

  • Munger1 Level 1 (0 points)

    Great stuff. I'll try that out. However, I am still puzzled at the lines in amavisd.conf being commented out. Why is this? If serveradmin allows me to set them, then why isn't it enabling them?

  • UptimeJeff Level 4 (3,445 points)

    You are posting in the Mountain Lion Server forum...

    Server Admin does not adjust settings in Mountain Lion Server


  • Munger1 Level 1 (0 points)

    I know. I said serveradmin (the command line tool), not the Server app. e.g. -


    serveradmin settings mail:postfix:spam_quarantine = spamcop@mydomain.com


    which will alter settings in amavisd.conf, but leaves them commented out.

  • UptimeJeff Level 4 (3,445 points)

    I never use serveradmin for those settings... so can't comment.

    You can do much more learning how to work directly with amavisd.conf, so go straight to the source.

  • Munger1 Level 1 (0 points)

    Yeah, I always worked directly with that when I hosted my mail on Linux, but prefer touse thesupplied tools where possible as it *should* provide a level of abstraction in the eventthat Apple decide to change the underlying mechanisms again. Of course, this is only true if they provide full support for all the options in their serveradmin tool, which does not appear to be the case.


    My concern about the commented out lines is that some other setting may be causing those options to be disabled when serveradmin writes it's settings, which may see them disabled again next time I use that tool.


    In the meantime I'm awaiting some spam emails to test the settings you suggested. Thanks for the info ;-)