Expand description
Clean delivery-action wrapper over Stalwart’s sieve crate
(RFC 5228 Sieve email filtering language + the common
extensions: fileinto, vacation, reject, redirect, …).
Stalwart’s sieve crate exposes a low-level event-loop API
(Runtime::filter(msg).run(input) returning a stream of
sieve::Event variants the caller has to translate into
their own delivery actions). That’s powerful but every consumer
ends up writing the same translation layer. This crate IS that
translation layer, plus the small extras a real MTA needs:
created_messagestracking sovacation/notifyreply bodies are matched to theirSendMessageevents- Envelope (
From/To) injection for:envelopetests and vacation auto-reply addressing - One
SieveActionenum the caller pattern-matches against in its delivery loop
Pure compile + evaluate: no I/O, no async. Plug into any script-storage layer (PG, file, in-memory) and any delivery backend (Maildir, IMAP, JMAP).
§Quick start
use mailrs_sieve::{compile_sieve, evaluate_sieve_with_envelope, SieveAction};
let script = "fileinto \"INBOX/spam\";";
let compiled = compile_sieve(script).unwrap();
let message = b"From: a@b.c\r\nSubject: t\r\n\r\nbody";
let actions = evaluate_sieve_with_envelope(
&compiled, message, Some("a@b.c"), Some("me@d.e")
);
assert!(matches!(actions[0], SieveAction::FileInto(ref f) if f == "INBOX/spam"));Enums§
- Sieve
Action - One delivery decision produced by
evaluate_sieve_with_envelope. The caller’s delivery loop pattern-matches and executes the corresponding storage / forwarding / DSN action.
Functions§
- compile_
sieve - compile a Sieve script, returning the compiled form
- evaluate_
sieve - evaluate a compiled Sieve script against a message
- evaluate_
sieve_ with_ envelope - evaluate a compiled Sieve script against a message with envelope information for vacation/auto-reply support