check-sieve(1)

NAME
check-sieve - Syntax checker for mail sieves.

SYNOPSIS
check-sieve [options] file [ file ... ]
check-sieve --help
check-sieve --version

DESCRIPTION
check-sieve is a simple syntax checker for server-side mail sieves. It supports many mail-sieve RFCs, details of which can be found below.

OPTIONS

-h, --help
    Show the program help

--max-list-length N
    Check length of string lists, and flag any that are longer than the specified length

--server <host>:<port>
    Connect to the specified server, and only enable advertised capabilities

--trace-parser
    Trace the operation of the parser

--trace-scanner
    Trace the operation of the scanner

--trace-tree
    Trace the abstract-syntax-tree

--simulate <email-file>
    Simulate sieve processing against an email file (.eml format). See SIMULATION below.

--test-dir <dir>
    Run simulation for every .eml file in dir and diff each result against a matching .out file. See SIMULATION below.

--rebase <dir>
    Regenerate the .out files in dir from current simulation output. See SIMULATION below.

--version
    Print out version information

SIMULATION
check-sieve can simulate how a sieve script sorts mail, making it straightforward to verify script behavior without deploying to a mail server.

  Single-message simulation

--simulate <email-file>
    Validates the sieve script and then evaluates it against the given .eml file. Each test that matches is printed as MATCH: <test> and each executed action as ACTION: <action>. If no delivery action is taken, keep (implicit) is added automatically per RFC 5228 §4.2.
    NOTE: Many RFC extensions are still in progress. Filing an issue for unsupported extensions will help prioritize what to work on next.

  Batch testing with a test directory
A test directory contains .eml files and, optionally, .out files that record expected simulation output. The .out file for a given email is named after the email's stem (e.g. msg.eml → msg.out).

--test-dir <dir>
    Runs simulation against every .eml file in dir. For each email that has a matching .out file, the actual output (with the environment-specific first line stripped) is diffed against it. If all comparisons pass the program exits 0 with no output. If any differ, each diff is printed followed by a summary on stderr and the program exits 1. Emails without a .out file are simulated but not compared.

--rebase <dir>
    Regenerates the .out file for every .eml file in dir, creating or overwriting as needed. Run this after making intentional changes to a sieve script or the simulator to update the expected output before re-running --test-dir.

BUGS
For information on existing issues, and to file a bug report check the following URL: https://github.com/dburkart/check-sieve/issues

AUTHORS
Dana Burkart
Stuart Montgomery

SUPPORTED RFCs
The full list of supported RFCs is:
    Sieve: An Email Filtering Language (RFC 5228)
    Variables Extension (RFC 5229)
    Date and Index Extensions (RFC 5260)
    Vacation Extension (RFC 5230)
    Vacation "Seconds" Parameter (RFC 6131)
    Include Extension (RFC 6609)
    Copying Without Side Effects (RFC 3894)
    Reject and Extended Reject Extensions (RFC 5429)
    Body Extension (RFC 5173)
    Relational Extension (RFC 5231)
    MIME Part Tests, Iteration, Extraction, Replacement, and Enclosure (RFC 5703)
    Imap4flags Extension (RFC 5232)
    Editheader Extension (RFC 5293)
    Regex Extension (DRAFT)
    Spamtest and Virustest Extensions (RFC 5235)
    Extensions for Notifications (RFC 5435)
    Subaddress Extension (RFC 5233)
    Ihave Extension (RFC 5463)
    Environment Extension (RFC 5183)
    Sieve Notification Mechanism: mailto (RFC 5436)
    Internet Message Access Protocol (IMAP) Events (RFC 6785)
    Converting Messages before Delivery (RFC 6558)
    Detecting Duplicate Deliveries (RFC 7352)
    Externally Stored Lists (RFC 6134)
    Delivering to Special-Use Mailboxes (RFC 8579)
    File Carbon Copy (FCC) (RFC 8580)
    Delivery by MAILBOXID (RFC 9042)
    Delivery Status Notifications and Deliver-By Extensions (RFC 6009)
    Extension for Processing Calendar Attachments (RFC 9671)
    Proton Expiration Extension (vendor-specific)
    Proton Eval Extension (vendor-specific)
    Dovecot Invoking External Programs (vendor-specific)