Recently transitioned from 10.7.5 Server to 10.9.4 Server. Apple dumped webmail in Mountain Lion Server so of course it’s gone in Mavericks Server too. With webmail gone there’s no way to implement filtering with a GUI at the server level anymore.
With the combination of push email and loads of scripts emailing me at all hours, I found even configuring the rules in Mail.app on the server itself wasn’t fast enough to prevent my phone from buzzing before the message was filed away (in the next second or two.)
I found tidbits all over the place but no comprehensive guide to configuring sieve in OS X Server (on Mavericks or ML.) I don’t know that this is comprehensive, but it’s more than I found. This is written assuming you’re at least a little comfortable on the command line.
Find your unique mail ID.
I just headed to /Library/Server/Mail/Data/mail/ and looked for the most recently modified folder since I’m by far the most active user on my server. You can also check the folder hierachy within it to see if those folders look like yours.
The safer way is to head to Server.app, open Directory Utility, switch to Directory Editor, make sure you’re in the right node (either /Local/Default for local users or /LDAPv3/127.0.0.1 for Open Directory users) and then select the user. The GeneratedUID is the value you’re looking for and looks like this: 704751C3-6F9D-4A10-8CA9-04E34CBA5B3C. I’m going to call this $USER_GUID.
Create Rules folder and sieve file
Fire up TextEdit.app, grab this text below, customize with your GUID value, then copy and paste the lines beginning with sudo into Terminal, one by one. Make sure there are no line breaks for the four lines that begin with “sudo” or the commands will not work. Here is a text version of it.
sudo mkdir -p /Library/Server/Mail/Data/rules/$USER_GUID
sudo chmod 775 /Library/Server/Mail/Data/rules/$USER_GUID
sudo nano /Library/Server/Mail/Data/rules/$USER_GUID/dovecot.sieve
(just type #replaceme for now, control+x, y, then return)
sudo chown -R _dovecot /Library/Server/Mail/Data/rules/$USER_GUID
Now comes the fun part, creating the rules.
The link below contains several examples in a format that will work directly in dovecot.sieve, with modifications for your rules and mailboxes of course.
There are far more advanced ways to edit the dovecot.sieve file, but for really basic usage you can use the line beginning with “sudo nano …” above and then either edit directly, or edit in something with a friendly GUI like TextWrangler and then copy and paste into dovecot.sieve. Just hold down control+K to delete the file line by line then paste from your editor. Yes this will make your average command line geek cringe, but it’s quite straightforward.
Click on this text for dovecot sieve examples.
—
I provide all of these rules to provide examples of what you can do. For what it’s worth I use one domain with a catch-all address, that way I can give companyname@mydomain.com email addresses out. If/when the address gets compromised I can block that exact email address (which is sometimes buried in the headers instead of in the To field.) This has happened at several small companies, and more recently Adobe, XM, and Toyota.
More examples can be found on the Dovecot LDA/Sieve page here: http://wiki1.dovecot.org/LDA/Sieve
As soon as you save the dovecot.sieve file the rules are in effect. If you run a test and it’s not working (and I do recommend testing with just one rule before implementing everything!) you’ll see dovecot.sieve.log right next to dovecot.sieve in /Library/Server/Mail/Data/rules/$USER_GUID/ telling you in fairly plain english (at least for a program) what you did wrong. Probably the easiest error to make would be leaving out a comma in one of the multiple rules, or adding an extra one on the last/only one.
If I’ve made an error or helped you out, I’d love to hear about it. Please email me at dovecot@ this domain name (without the www.) Thanks!