Postmaster-K
For those of us who run our own mail-servers and like sorting email automatically…
Postmaster-K is a small Rust utility that procmail calls on every incoming message. You define the categories — work, invoices, newsletters, friends, spam, whatever — and it tags each message as it arrives. Not just the old binary categorization of spam/no-spam: this allows as many named categories as you like, each deliverable to its own mailbox.
If you remember bogofilter, you know how to integrate it into ~/.procmailrc. Postmaster-K lives in the same spot, except its verdict is a category name rather than a yes/no, and it keeps learning as mail flows — every correction shows up on the very next message. You can even run it alongside bogofilter if you want: keep your existing spam gate and let postmaster-k handle the filing underneath it.
Mechanically: each message is tokenized, feature-hashed into a fixed-size vector, and matched by nearest-neighbour against a disk-backed (mmap’d) index. One binary, no daemon, no model file, milliseconds per message.
Postmaster-k understands four subcommands:
- learn — feed labelled examples into a category
- infer — the procmail hot path: classify one message and print
the verdict; with –learn it reinforces itself as
mail flows - autocalibrate — grid-search the tunables against a sample of your
real mail and write the best settings back - analytics — show the categories it knows and the strongest terms
behind each verdict
Getting started:
% postmaster-k init
% postmaster-k learn spam .Junk/
% postmaster-k learn friends .friends/
% postmaster-k autocalibrate ~/mail/sorted/
…then tag and deliver in procmail. It’s fail-open: on any internal error
the message simply passes through unclassified, so postmaster-k can’t be
the thing that eats your mail.
Grab it here: https://github.com/spodzone/postmaster-k
Happy hacking 🙂