Automatically Flag Apple Emails with Ollama AI

Automatically Flag Apple Emails with Ollama AI


As a developer, my inbox is my lifeline – and a constant source of headaches. I’m drowning in emails, and frankly, I’m tired of manually sorting through the chaos. I rely heavily on the Apple ecosystem, and while Apple’s AI features are slowly improving, they haven’t made a dent in my Mail situation yet. It’s been over two years since generative AI took the world by storm, and it’s frustrating that something as basic as intelligent email categorization is still missing in action.

Plus, like many, I’m a bit hesitant to just hand over all my email data to big players like OpenAI. My privacy matters, and I’m not comfortable with the idea of every message being analyzed by a third-party black box.

So, I decided to leverage the power of Ollama, to automatically categorize and flag my incoming emails right within Apple Mail. This tutorial will walk you through how I created an Apple Mail rule that triggers a custom script, utilizing my own Ollama model to determine the appropriate category (flag) for each email. 

The result? A significantly more organized inbox, less time wasted on manual triage, and the peace of mind that comes with knowing my data stays under my control.

Let’s dive in and reclaim our inboxes!



Prerequisites

  1. Install Ollama from ollama.ai
  2. Pull your preferred Ollama model (e.g., mistral, llama2)
ollama pull mistral
Enter fullscreen mode

Exit fullscreen mode



Setup Instructions



1. Create the AppleScript File

Create a new file named flag-ollama.scpt in your Mail scripts directory:

mkdir -p ~/Library/Application Scripts/com.apple.mail
touch ~/Library/Application Scripts/com.apple.mail/flag-ollama.scpt
Enter fullscreen mode

Exit fullscreen mode



2. Add the Script Content

Copy the following code into flag-ollama.scpt:



3. Customization Options

Read more in my Blog



Source link
lol

By stp2y

Leave a Reply

Your email address will not be published. Required fields are marked *

No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.