Dev.to AI 🤖 Ai 👁 2 📖 3 min read

I built an open-source AI spam filter for Apple Mail

The junk filter in Apple Mail kept letting cold pitches, scams and phishing through to my Inbox. So I built Coincide, a free, open-source spam filter for Apple Mail on the Mac. A model you choose reads each new message a

The junk filter in Apple Mail kept letting cold pitches, scams and phishing through to my Inbox. So I built Coincide, a free, open-source spam filter for Apple Mail on the Mac. A model you choose reads each new message and sends the unwanted ones to Junk.

What it does

Coincide is a Mac app that contains a Mail extension. Mail calls the extension as each new Inbox message downloads. The model returns one of five verdicts, with one sentence saying why:

  • legitimate
  • cold pitch
  • spam
  • scam
  • phishing

If the message is unwanted, Coincide tells Mail to move it to Junk. Mail does the moving on your mail server, so the message is in Junk on your other devices too. Anything uncertain stays in your Inbox.

It works with every account set up in Apple Mail, and it never needs an account password, because it never connects to your mail server.

Facts checked in code first

Before the model is asked anything, Coincide's own code works out a set of facts about the message and hands them over:

  • A well-known brand name in the sender's display name while the address is on an unrelated domain.
  • Whether it was sent from a free personal mail address.
  • A Reply-To on a different domain than the sender.
  • SPF, DKIM and DMARC results.
  • Where links lead, whether that differs from the sender's site, and raw-number addresses or look-alike characters.
  • Whether it is a real reply inside an existing thread, or just a subject that starts with "Re:".
  • An unsubscribe header, which means bulk mail.

Comparing domains and reading authentication results is exact work, and code is good at it. I would rather hand the model the answer than hope it works it out.

You pick the model

  • On your Mac: Apple Intelligence, Ollama or LM Studio. No email leaves your Mac or network.
  • Your own API key: OpenAI, Anthropic, Google Gemini, OpenRouter, DeepSeek, or any OpenAI-compatible server.
  • A tool you already use: Claude Code, Codex or OpenCode, with its own sign-in and no key to enter.

You can also set a fallback model, which is asked when the first one fails, is over its limit or takes too long.

Things I cared about

  • A reason for every decision. The Activity page lists every decision with the model's one-line reason. It stays on your Mac.
  • Watch Only. It flags what it would move and moves nothing, so you can check its work before you trust it.
  • Your own rules. Write what you count as unwanted in plain sentences, and keep Never Spam and Always Spam lists of senders and domains.
  • No account, no server of mine, no analytics. Settings, keys and history stay on your Mac. The app is not sandboxed, but the Mail extension, the only part that reads mail, is.

Limits

  • Mail offers a message when it downloads it, so mail that arrives while the Mac is asleep may not be offered. That is a limit of Mail.
  • There is no iPhone or iPad app. Your Mac does the filtering, and the move to Junk shows up on your other devices.
  • No model is perfect, so look in Junk now and then, especially in the first week.
  • It needs macOS 26 or later.

Try it

brew install --cask apoorvdarshan/tap/coincide

Or download it from coincide.dev. Then open Mail, choose Mail > Settings > Extensions and select Coincide.

If you try it, tell me what it gets wrong on your mail. That is what I most want to fix.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.