Auto-label Gmail and draft replies with a local model (n8n)
What they built
Tony Adijah's n8n template for people drowning in email. It classifies, labels and drafts replies using a model running locally in Ollama.
Setup
- Self-hosted n8n (recommended for Ollama connectivity)
- Ollama at http://localhost:11434 with e.g. mistral
- Gmail OAuth (read, modify, compose); Google Sheets optional
How it works
- Gmail trigger checks unread mail (default every 30 minutes)
- Ollama returns category, priority, confidence, summary, action, sentiment and an optional reply draft
- A router applies one of six labels: Urgent, Action Required, Follow-up, Newsletter, Automated, Spam-Promo
- Drafts are created for Urgent and Action Required mail
- Every email is logged to Google Sheets
Do it yourself
- Create the six Gmail labels and look up their IDs
- Import the template and connect Gmail OAuth
- `ollama pull mistral` and set the model in the Ollama node
- Send yourself test emails and run manually to check accuracy
Source: n8n templates · Added 2026-10-18. This write-up summarizes the original source; see it for full details.
Related
Self-hosted bookmarks that tag themselves with local AI (Karakeep)
Karakeep (formerly Hoarder) runs on a Debian LXC, and gemma3:4b in Ollama tags each bookmark. Getting reliable tags from a small model takes one key setting.
Hybrid workflow: local for private and repetitive, cloud for hard
A Linux sysadmin stopped trying to replace cloud LLMs. Ollama now handles private docs, overnight article summaries and VS Code autocomplete.
Read-only personal admin assistant over work email and calendar
A project manager juggling a dozen projects has a local bot that builds a wiki from email, surfaces to-dos, sends reminders and drafts replies.
Self-hosted AI email assistant on Linux (n8n + Ollama)
Classifies IMAP mail with llama3.1:8b, routes it, saves reply drafts and extracts action items as JSON. Reports 85-95% classification accuracy.