AI Email Sorting for Self-Hosted Mail Servers
The problem: you run your own mail server for a reason
You didn’t set up Mailcow, Mailu, or a hand-rolled Postfix/Dovecot stack by accident. You wanted control over your own data, and you got it — at the cost of every “smart inbox” feature that Gmail and Outlook users take for granted. Most AI email tools only support Gmail and Outlook and run cloud-only, which is a non-starter if your mailbox lives on hardware you administer. The result is a familiar trade-off: keep your self-hosted setup and sort mail by hand, or give up the thing you built it for just to get automatic sorting.
That trade-off is unnecessary. AI Email Filter connects to any IMAP/SMTP server — including Mailcow, Mailu, and fully custom setups — the same way it connects to Gmail. No migration, no OAuth requirement, no assumption that “self-hosted” means “unsupported.”
Why classic if-then filters fail here
Sieve rules and procmail recipes work by matching patterns: sender address, subject keyword, header value. That’s fine for stable, narrow cases — mail from one address always goes to one folder. It falls apart the moment the thing you’re trying to catch doesn’t have a fixed pattern. Modern spam and cold outreach rotate sender domains, spin up plausible-looking subject lines, and don’t repeat the same header fingerprint twice. You end up maintaining a growing list of brittle rules that catches yesterday’s spam and misses today’s. Rspamd on Mailcow scores mail well on technical signals — SPF, DKIM, DMARC, Bayes — but it’s not evaluating what a message is actually about, which is exactly the gap semantic sorting needs to fill. (If Mailcow’s spam filter specifically is the problem, see fixing Mailcow’s spam filter once and for all.)
How prompt-based sorting solves it
Instead of pattern rules, you describe each category in plain language, and AI Email Filter classifies incoming mail — or, once a sender’s been seen, just that sender — against your descriptions. A few examples of the kind of prompt this replaces a rule stack with:
- “Cold outreach, LinkedIn spam, or someone trying to sell me something” — catches the semantic pattern of sales pitches regardless of which domain they’re sent from this week.
- “Anything related to the [project name] server migration” — groups every message about a specific piece of infrastructure work, even from people who’ve never emailed you before.
- “Deals and updates from the hosting and domain vendors I actually use” — separates renewal notices you need from vendor marketing you don’t, without hardcoding sender addresses that change when a vendor switches billing systems.
This runs on top of your existing spam filtering, not instead of it — Rspamd still does the technical scoring; AI Email Filter handles the semantic sorting Rspamd was never built to do.
Keeping it self-hosted end to end
If the whole point of running your own server is that your mail doesn’t touch someone else’s infrastructure, sending every message to a third-party AI API defeats the purpose. Bring Your Own LLM lets you point classification at a local Ollama instance instead — no email content leaves your infrastructure at all. You still get Sender Smart Categories caching each sender’s classification so repeat mail from your own team or regular vendors sorts instantly without a second inference call.
FAQ
Does this replace Mailcow’s built-in spam filter?
No. Rspamd keeps doing SPF/DKIM/DMARC and Bayesian scoring. AI Email Filter adds a second, semantic layer on top for the kind of mail that’s technically valid but categorically wrong for your inbox — sales pitches, off-topic requests, mail that should go straight to a specific project folder.
Can I run the classifying model locally so no email content leaves my server?
Yes. Bring Your Own LLM supports a local Ollama instance in addition to OpenAI or any OpenAI-compatible endpoint. With Ollama, classification happens on hardware you control and nothing leaves your infrastructure.
Which self-hosted mail servers actually work with this?
Anything that speaks IMAP/SMTP: Mailcow, Mailu, custom Postfix/Dovecot stacks, and the standard hosted providers (Gmail, Yahoo, ProtonMail via Bridge, Fastmail) if you run a mixed setup. There’s no migration step — you connect your existing server. (Outlook/Microsoft 365 support is coming soon via Microsoft sign-in.)
Try it on your own server
AI Email Filter includes 200 free classifications, no credit card required, so you can test it against your real mail volume before committing. Full plans start at $6/month for unlimited classifications — see pricing.
Ready to put your inbox on autopilot?
Get Started Free