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.
Generated AppleScript
How to install in Mail
- Click Download, then open the downloaded file in Script Editor.
- 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.
- In Mail, open Mail > Settings > Rules, then click Add Rule.
- Give the rule a name, choose the condition you want, and under Perform the following actions pick Run AppleScript and select flag-spam-ollama.
- 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.
This screenshot shows Mail > Settings > Rules with the Add Rule button highlighted.
This screenshot shows the rule editor with Run AppleScript selected and the flag-spam-ollama script chosen.
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
- Install and run Ollama on the same Mac where Mail will execute the rule.
- Choose the strongest local model you want to run, such as gemma4:latest or another Ollama model available on your machine.
- Leave the endpoint as http://localhost:11434/api/generate unless your Ollama setup is different.
- 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.