NEW

Klar now filters spam for Stalwart, on your own mail server.

Set it up

Spam filtering for your own mail server.

The Klar engine as a Postfix or SMTP milter, on infrastructure you control. Run it in any region you choose, and your mail never leaves your servers.

Inline at your mail server

Klar runs as a milter beside your mail server. It reads each message once, before it is queued, and adds X-Klar headers. A Sieve rule at delivery files it on the verdict: Inbox, Marketing or Junk. Reject mode can also refuse the clearest spam at SMTP time.

Mail arrives from the internet over SMTP at your mail server, Postfix, Stalwart or anything that speaks milter. Before queueing, the server hands the whole message to klar-milterd on the same box, which classifies it locally with no network call and returns X-Klar headers such as X-Klar-Label: spam. A Sieve rule at delivery files the message to Inbox, Marketing or Junk. klar-milterd writes the verdict, scores, sender and Message-ID to a SQLite event store, never the body.
  • Drops into Postfix

    Klar runs as a milter. Every inbound message is classified by the on-device engine and tagged with X-Klar headers. Your Sieve rules file spam to Junk.

  • Stays on your infrastructure

    Classification runs where your mail already lives. Nothing is sent to a third party. That is the sovereignty cloud gateways cannot offer.

  • Learns from your users

    When users move mail to or from Junk, Klar records the correction and adapts, on your servers, not ours.

Run it on Stalwart.

Stalwart hands every inbound message to the Klar milter, the engine classifies it on your box, and a per-mailbox Sieve rule files on the verdict. The binaries run on Debian 12 or Ubuntu 22.04 and up on x86_64, and Debian 13 or Ubuntu 24.04 on arm64. Older systems run the container. Install, give it your Stalwart admin login, wire it in:

curl -fsSL https://raw.githubusercontent.com/klar-im/engine/main/install.sh | sudo KLAR_ACCEPT_MODEL_LICENSE=1 sh
export STALWART_URL=http://127.0.0.1:8080 STALWART_USER=admin STALWART_PASSWORD=...
python3 /opt/klar/share/stalwart/scripts/apply.py --shadow --milter-host 127.0.0.1 --milter-port 8891

Klar decides. Stalwart's own filter can keep scoring alongside it without filing anything, so you can compare the two verdicts on your own mail for as long as you like.

On Postfix, add KLAR_MTA=postfix to the install line and it writes the Postfix config instead, then follow the Postfix guide.

Read the engine, run it yourself.

The Klar engine is open source under AGPLv3. Build it, audit it, and see exactly what runs on your servers. AGPLv3 means changes you ship have to stay open. If that does not fit your business, a commercial licence is available.

It ships with one milter for two mail servers: a reference Postfix setup, and the Stalwart wiring. Point either at the same engine.

View the engine on GitHub

Run it on your own server.

The milter is open source and installs with one command. The model is free for non-commercial use; filtering a company's mail takes Klar Pro, the commercial licence. Tell us about your setup.