Smart Gmail Organization: Auto-Label Emails Using AI (Free & Open Source)
Automate your Gmail inbox with AI! This n8n workflow uses local AI (Ollama) to automatically categorize and label incoming emails based on their content. Perfect for organizing customer inquiries, support requests, and general messages without manual sorting.
12/3/2025

Features:
Automatic email categorization using AI
Custom label assignment (ex. Prices Info, Consultation, Others)
Runs on your local machine with Ollama or you can use any other AI model.
Completely free and open-source
Polls Gmail every minute for new messages
Helpful links:
n8n: https://n8n.io
Ollama: https://ollama.ai
Download Workflow JSON: https://github.com/Zimbocu/Gmail-auto-label-system/tree/main
Issues & Solutions:
Make sure to create the labels in Gmail FIRST (Prices info, Consultation, Others)
Label names must match EXACTLY in both Gmail and the workflow JSON schema
If you get "credentials not set" error, add Gmail OAuth to ALL Gmail nodes
Common Errors:
"Model output doesn't fit format" → Update the system prompt
"No output from merge" → Check label names match exactly
