Dad, Software Nerd, Human

check-sieve(1)

https://github.com/dburkart/check-sieve

In a previous job I used mail sieves extensively to manage the flood of emails (mostly automated) sent to my team. Breaking my sieve would routinely result in mountains of email to sort through in my inbox. Of course, I tried using various online (and offline) tools for checking the syntax of my script, but errors generated by these tools often boil down to an unhelpful "Syntax error in sieve script".

The check-sieve tool was how I set out to solve the problem. It's a full on parser for the myriad of mail sieve RFCs, and tries first and foremost to give informative errors.

Example error generated by check-sieve

λ › check-sieve test.sieve
Errors found in "test.sieve":

Incorrect syntax for test "environment".
On line 2:
if environment :is "bogus" "check-sieve" {
   ^^^^^^^^^^^
Usage: environment [COMPARATOR] [MATCH-TYPE] <name: string>
                   <key-list: string-list>
                   Where name is one of: domain, host, location, name, phase,
                                         remote-host, remote-ip, or version

You can try out an in-browser demo at checksieve.com.

The nice thing about the tool is that you can point it at your mail server, and it will only turn on extensions that are advertised by that server.