Get your junk mail prefix back in OS X mail server options

The latest upgrade to OS X 10.9 - a.k.a. Mavericks - has a lot of new features for the end use to appreciate. However, the upgrade to OS X Server has a handful of changes that force more and more to be done via the command line. One such change is the ability to append a prefix in the subject line of junk email, for those of you running your own mail server from OS X. Mountain Lion use to offer this handy option, since it didn't provide true junk mail filtering into the Junk folder unless the sender was previously marked as a junk sender either from cross checking through an RBL or with a manual assignment with ⇧⌘J.

Luckily with a simple command entered through the Terminal, you can append email subject lines again with whatever you choose. The command is:

sudo serveradmin settings mail:postfix:spam_subject_tag = "***DIEEVILSPAMMERSDIE*** "  

You can customize ***DIEEVILSPAMMERSDIE*** to whatever you choose. In my case, I borrowed Mountain Lion's ***JUNK MAIL*** prefix.

A few caveats:

  • The command must be run as sudo, since you are modifying a system file, in this case, the postfix preference file.
  • Anything you type between the quotes in the subject_tag string will be appended to the front of mail marked as junk. Be careful what you type here. You can always fix it, buy running the command again from the Terminal.
  • As you might imagine, local access to the server is not necessary and the command can be run via SSH
  • A small but important item: be sure to include a space at the end of the text to be appended to the subject line, otherwise you might come out with the text smushed together, something like this: ***JUNK MAIL***FAMILY REUNION PHOTOS

I've implemented this with success for my mail server. If you're missing this feature in OS X Server Mavericks, give this a try.

Source: Configure the Mail Service in Mavericks Server | Krypted