Free, Local, Ollama-Based

Block phishing and spam with local LLMs.

Use Apple Mail with Ollama to detect phishing, spam, and malicious email with strong local models on your own machine. 100% free and open source. No paid API required. No hosted backend. The script generator below is just the setup step.

100% free to use Open source Powered by Ollama Built for phishing and spam blocking

Set up your blocking script

Choose the detection mode and a few high-value settings. After generation, you can download the AppleScript and attach it to Mail.

Preset

Core Settings

Mail Behavior

Optional Tuning

Generated AppleScript


    

How to install in Mail

  1. Click Download, then open the downloaded file in Script Editor.
  2. In Script Editor, save it as a script named flag-spam-ollama.scpt into ~/Library/Application Scripts/com.apple.mail/. If Mail is already open and the script does not appear later, quit and reopen Mail.
  3. In Mail, open Mail > Settings > Rules, then click Add Rule.
  4. Give the rule a name, choose the condition you want, and under Perform the following actions pick Run AppleScript and select flag-spam-ollama.
  5. Click OK. To run it on existing messages, right-click messages in Mail and choose Apply Rules.
The screenshots show the exact flow: Mail settings, the Rules tab, adding a rule that runs the AppleScript, then applying rules from the message list.
Mail Settings on the Rules tab with the Add Rule button highlighted.
1. Open Mail Rules and add a rule

This screenshot shows Mail > Settings > Rules with the Add Rule button highlighted.

Mail Add Rule dialog showing Run AppleScript and the flag-spam-ollama script selected.
2. Choose Run AppleScript

This screenshot shows the rule editor with Run AppleScript selected and the flag-spam-ollama script chosen.

Mail message context menu with Apply Rules highlighted.
3. Apply rules to existing messages

This screenshot shows the Mail message menu with Apply Rules highlighted so you can run the blocker on messages already in your inbox.

Why local LLMs matter

  1. Install and run Ollama on the same Mac where Mail will execute the rule.
  2. Choose the strongest local model you want to run, such as gemma4:latest or another Ollama model available on your machine.
  3. Leave the endpoint as http://localhost:11434/api/generate unless your Ollama setup is different.
  4. Mail runs the AppleScript locally, and the script sends the message content to your local model so the LLM can judge phishing and spam patterns more intelligently.
This page does not depend on a hosted service. The actual value is local LLM-based phishing and spam blocking, with the script generator acting as the setup mechanism.