Generate and deploy Sieve rules from JSON in .NET.

Transiever.SieveRuler is the provider-neutral rule engine behind Transiever: it models mail rules as JSON, renders Sieve, reconciles existing scripts, and manages safe deployment workflows.

Create a .NET 10 console application

With the .NET 10 SDK installed, create a new project and add the SieveRuler library.

PowerShell or Bash

dotnet new console --framework net10.0 --name SieveRulerQuickstart
cd SieveRulerQuickstart
dotnet add package Transiever.SieveRuler

Generate Sieve locally

Replace Program.cs with this example. It defines a subject filter and renders a Sieve script in memory.

C#

using Transiever.SieveRuler.Models;
using Transiever.SieveRuler.Services;

RuleDefinition rule = new()
{
    Name = "Newsletters",
    TargetFolder = "INBOX/Newsletters",
    Conditions =
    [
        new() { Type = RuleConditionType.SubjectContains, Values = ["newsletter"] }
    ]
};

string sieve = new SieveGenerator().Generate([rule]);
Console.WriteLine(sieve);

Run the application from its project directory.

dotnet run

The result prints a script with a subject test and a fileinto action. No server connection or credentials are needed. Before deployment, adjust the example folder to your provider's naming and check support for the fileinto extension.

Generate from JSON with srtx

For an existing rules document, use the srtx global tool instead of writing application code. This alternative requires .NET 10. Obtain a document from an Outlook export, a Thunderbird export, or the v1 rules schema. Save a copy as rules.json in a new working directory before running these commands.

PowerShell or Bash

dotnet tool install --global Transiever.SieveRuler.Cli
srtx inspect --rules rules.json
srtx generate --rules rules.json --sieve rules.sieve

This writes rules.sieve locally and does not change server rules. Self-contained Windows and Linux x64 builds are also available through Scoop and Homebrew.

Add deployment when you need it

For a ManageSieve-capable provider, SieveRuler also provides reconciliation, preview, deployment, and rollback. Preview writes review artifacts without mutating the server; deployment is a separate state-changing step.

Follow the CLI guide for connection setup and deployment, and the library reference for application APIs. Use Transiever.ManageSieve when you only need direct protocol operations.