FromOZ

Q: Auto move junk email to IMAP junk folder

Hi — I want to fine tune my server email (Postfix/Dovecot/Spamassassin/Amavis) setup for dealing with SPAM/Junk email. Basically I don't want to have users look at junk email in their inboxes. I would like to have a setup whereby all junk tagged email, i.e. with 'X-Spam-Flag: YES', automatically goes into the Junk folder on the IMAP server. Further I would like to have really obvious/bad SPAM/Junk (with really high scores) automatically deleted.


Specifically what I would like to achieve is the following:

 

  1. Don't add ***JUNK MAIL*** to the email subject, in the case of false positives it's not nice to have the subject re-written with that.
  2. Use the header X-Spam-Flag = 'YES' as the criteria for dealing with the email as being (potential) SPAM/Junk.
  3. On the server send all junk email directly to the IMAP folder 'Junk'. The reason I want to do this on the server is because iOS, unlike the mail app on OS X, has no mechanism for moving junk flagged emails to the Junk folder so users keep seeing them in their (iOS) mail app.
  4. Use the junk mail filter minimum score (settable in Server.app) to set the minimum score for tagging emails as junk. This obviously can be monitored and adjusted by reviewing incoming emails over a period of time.
  5. Use the kill level setting (done via editing config file) to automatically delete emails having a junk score > than the level I set in the conf file.

 

I have seen in other threads the idea of using sieve scripts and/or using method of using email address modification through the "+" recipient delimiter to action moving emails to the IMAP Junk folder


Global Sieve Script to move Junk mail (Snow Leopard Server)


but I would prefer not to change either the email subject and/or recipient. Especially as there is already a flag (X-Spam-Flag) available for this purpose which surely...must be able to be checked in Amavis/Postfix/Dovecot? On this point I am curious as to where (which of the previous systems) it is best to do this action performance and efficiency wise. Also some of the solutions are for older versions of OS X Server.app and version 4-5 has changed somewhat.


I have already seen looking at config files where some of the settings can be done, obviously (and unfortunately) OS X Server.app provides very little functionality for providing this solution.


I am curious what solution others have found particularly as this means tying together various systems. Hopefully someone has been down this road already and has a good solution. I am comfortable editing any configuration files. I plan to start tracking edits with Git anyway (but that's another topic).


I believe this is, will be, a helpful functionality for any OS X Server mail admin. Thanks in advance for any tips/ideas/solutions.

Mac mini, OS X El Capitan (10.11.2), OS X Server 5

Posted on Jan 2, 2016 5:19 AM

Close

Q: Auto move junk email to IMAP junk folder

  • All replies
  • Helpful answers