How to Automate Your Email Inbox with n8n (Triage, Route, and Auto-Reply)
Learn how to automate email triage, routing, classification, and auto-replies with n8n. Stop managing your inbox manually — build a hands-free email system.
Your Inbox Is a Queue. n8n Can Run It for You.
Most knowledge workers spend 2–4 hours a day on email. Sorting, reading, deciding who to forward to, writing the same replies again and again. That is operational overhead, not actual work.
n8n can intercept every incoming email, classify it by intent, route it to the right person or system, and send a contextual reply — all before you open your inbox. The trigger is a new message; the outcome is a processed, labeled, and acknowledged email without manual intervention.
This post covers practical patterns: inbox triage at scale, content-based routing, and intelligent auto-replies using n8n's Gmail, IMAP, OpenAI, and Slack nodes.
What You Can Automate
Email automation with n8n handles the full inbox lifecycle:
- Auto-classify incoming emails into categories (lead, support, billing, spam) using AI or keyword rules
- Route messages to the right Slack channel (#sales, #support, #billing) based on content
- Send instant auto-replies to common inquiries — pricing questions, availability, support acknowledgments
- Convert emails to tasks in Notion, Linear, or Asana when they contain action items
- Extract structured data from emails (invoice amounts, tracking numbers, form responses) and write to Google Sheets
- Forward specific email types to the right team member based on sender domain or keyword
- Create CRM contacts from inbound sales emails and assign them to a rep automatically
- Generate a daily digest summarizing unread emails by category
The Email Inbox Automation Pipeline
Every email workflow in n8n follows this structure:
Trigger → Classify → Route → Act → Confirm
The trigger fires on each new email. Classify uses AI, regex, or keyword matching to assign an intent category. Route sends the email to the correct branch. Act takes the right action — reply, create task, notify team. Confirm closes the loop by applying a Gmail label, logging to a spreadsheet, or posting a Slack message.
Step-by-Step Breakdown
1. Collect
Two nodes handle email triggers:
Gmail Trigger: connects via OAuth to your Gmail account and fires on every new message in a specified label or inbox. Returns sender, subject, body text, snippet, and message ID. Near real-time — checks every 1–2 minutes.
IMAP Email node: works with any IMAP server — Outlook, Fastmail, custom SMTP, G Suite — and polls on a schedule. Returns the same fields plus raw headers. Set the poll interval to 1–5 minutes for most use cases.
For shared inboxes (support@, sales@), use a service account or alias that both trigger types support.
2. Process / Segment
Raw email text rarely maps directly to a decision. Two approaches work well:
Keyword-based classification: Use an IF node chain. Check if the subject or body contains terms like "invoice", "pricing", "refund", or "urgent". Fast, zero API cost, deterministic. Works well for high-volume inboxes where categories are well-defined.
AI classification: Pass the subject and body to an OpenAI node with a prompt like: "Classify this email into one of: lead, support, billing, other. Return only the category name." The response is a single word — easy to branch on downstream. More flexible for ambiguous inputs.
Use keyword rules first for high-confidence categories — a subject starting with "Invoice #" maps directly to billing. Fall through to the AI classifier only for emails that do not match any keyword rule. This cuts API costs and keeps latency low for the easy cases.
3. Route
A Switch node reads the category field set in step 2 and sends each email to the matching branch:
lead→ create CRM contact and notify #salessupport→ create support ticket and send acknowledgment replybilling→ notify #billing and escalate if the keyword "urgent" is presentother→ apply Gmail label "review" and take no further action
Each branch is independent — you can add, remove, or modify one branch without touching the others.
4. Act
Actions vary by branch, but the most common are:
Auto-reply: use the Gmail node's Send Email action. Set the recipient to the sender's address using ={{ $json.from.value[0].address }} and the subject to Re: ={{ $json.subject }}. Write the reply body as a static template or generate it dynamically with OpenAI.
Create a task: use the Notion, Linear, or Asana node to create an item with the email subject as the title and the body as the description. Attach the sender email as a property.
Log to Sheets: use the Google Sheets node to append a row — timestamp, sender, subject, category, and action taken.
After acting on an email, use the Gmail node's 'Add Label' action to mark it as processed — for example, "n8n-handled". This creates a clean audit trail and prevents the same email from triggering the workflow twice if the trigger checks the inbox again before the label propagates.
5. Follow Up
After the main action, close the loop:
- Notify the team in Slack with the sender name, category, and a link to the original Gmail thread.
- Update the CRM — if the email was a lead, log the touchpoint in HubSpot or Pipedrive as an activity on the contact.
- Trigger a follow-up sequence — if no reply is received after 48 hours, a scheduled workflow can check timestamps and fire a follow-up email automatically.
Implementation Patterns
Pattern 1: Lead Triage and CRM Routing
New sales emails are classified, routed to the right rep, and logged to a CRM — no manual reading required.
Gmail Trigger (inbox)
→ OpenAI: classify intent
Prompt: "Is this a sales lead, support request, or other? Return one word."
→ Switch: on category value
"lead" →
HTTP Request: POST to HubSpot Contacts API
email = from.value[0].address
name = from.value[0].name
source = "Inbound Email"
→ Slack: Post to #sales
"New lead from [sender name]: [subject]"
"support" →
HTTP Request: POST to Zendesk Tickets API
→ Gmail: Reply with support acknowledgment template
"other" →
Gmail: Add Label "review"
The CRM row is created immediately, the rep is pinged in Slack, and the email is labeled. No inbox monitoring needed.
Browse email automation templates →Pattern 2: AI-Powered Auto-Reply
Common questions — pricing, availability, how-to — get an instant, personalized reply drafted by OpenAI and sent automatically.
Gmail Trigger (filter: label:inbox -label:n8n-handled)
→ OpenAI: draft a reply
System: "You are a support assistant. Answer product questions concisely."
User: [subject] + [body text]
→ IF: reply length > 20 chars AND reply does not contain "I don't know"
TRUE →
Gmail: Send Email
To = sender address
Subject = "Re: " + original subject
Body = OpenAI draft output
→ Gmail: Add Label "n8n-handled"
FALSE →
Gmail: Add Label "needs-human"
→ Slack: Post to #support with full email details
The confidence gate prevents nonsense replies. Emails the model cannot handle confidently are flagged for human review instead of auto-sent.
Pattern 3: Email-to-Task Converter
Emails with action-oriented language are automatically converted into tasks in your project management tool.
Gmail Trigger
→ OpenAI: extract action items
Prompt: "List any action items from this email as a JSON array of strings.
If none, return an empty array []."
→ Code: parse JSON and split into individual task items
return JSON.parse(items[0].json.text).map(task => ({ json: { task } }))
→ IF: array length > 0
TRUE →
Notion: Create Database Item (for each task)
Title = task string
Source = "Email: " + original subject
→ Gmail: Add Label "tasked"
FALSE →
Gmail: Add Label "no-action"
When OpenAI returns a JSON array of action items, a Code node lets you split it into individual workflow items so each task flows into Notion as a separate row. The pattern is: return parsedArray.map(task => ({ json: { task } })). Each output item creates one Notion database entry.
n8n Nodes You'll Use Most
| Node | Purpose |
|---|---|
| Gmail Trigger | Fire on new inbox messages in real time |
| IMAP Email | Poll any IMAP mailbox on a schedule |
| OpenAI | Classify email intent, draft replies, extract action items |
| IF | Branch on categories, keyword matches, or confidence scores |
| Switch | Route to multiple branches by email category |
| Gmail | Send replies, add or remove labels, archive messages |
| Slack | Notify channels with email summaries or routing alerts |
| HTTP Request | Create records in CRMs, ticketing systems, or custom APIs |
| Google Sheets | Log processed emails, categories, and actions taken |
| Notion | Convert emails to tasks or structured database entries |
Getting Started
- Connect your email account: in n8n, go to Settings → Credentials → New → Gmail OAuth2 and complete the OAuth flow. For non-Gmail providers, add an IMAP Email credential with your server host, port, username, and password.
- Add the trigger node: drop a Gmail Trigger (or IMAP Email) on the canvas, select your credential, and set it to watch the inbox or a specific label. Click "Test" to fetch a sample message and inspect the payload structure.
- Build the classifier: start with an IF node checking the subject field for known keywords. Once that runs cleanly, add an OpenAI node as a fallback for emails that do not match any keyword.
- Wire the Switch node: map each category string to its own output branch. Connect each branch to the correct action node — Gmail reply, Slack message, Notion create, or HTTP Request.
- Write auto-reply templates: for the Gmail "Send Email" node, write a fixed reply body first to verify the flow end-to-end. Replace it with an OpenAI-generated response once the routing works correctly.
- Add the processed label: after every successful branch, apply a Gmail label (e.g., "n8n-handled") so the same email is not processed again on the next trigger run.
- Test with real messages: send yourself test emails in each category. Confirm labels appear, Slack messages arrive, and tasks are created before activating the workflow permanently.
For a ready-to-deploy starting point, the Email Followup Automator template handles outbound follow-up sequences built on the same Gmail foundation. For lead classification and routing specifically, the AI Lead Scoring and Email Routing template covers the full classification-to-CRM flow out of the box.
If you are routing sales emails into a CRM and need to manage the pipeline after the lead arrives, see How to Automate Your CRM Workflows with n8n for contact management, deal tracking, and follow-up patterns.
For teams using Gmail alongside Google Workspace tools, How to Automate Google Workspace with n8n covers Calendar, Drive, Sheets, and Gmail working together in a single unified workflow.
Explore n8n automation templates →Common questions
Can n8n read and process incoming emails automatically?
How do I set up AI-powered auto-replies with n8n?
What is the best way to route incoming emails to different Slack channels or teams with n8n?
Get the workflow templates this guide is built on
Import-ready n8n JSON, step-by-step setup, and tested end-to-end. One-time payment, own it forever.
More automation guides

How to Automate Airtable with n8n (Sync, Update, and Trigger Workflows from Your Database)
Airtable Is Your Database. n8n Makes It Behave Like a Full Automation Platform. Airtable is where teams store structured data — project trackers, CRM records, content calendars, inventory, hiring pipe…

How to Automate Notion Workflows with n8n (Databases, Pages, and Syncs)
Notion Is Your Team's Source of Truth. n8n Keeps It Accurate Without the Manual Work. Notion is where teams track projects, log decisions, manage content pipelines, and maintain wikis. The problem is…

How to Automate Slack Alerts, Approvals, and Team Notifications with n8n
Slack Is Where Your Team Lives. Most of the Noise Shouldn't Require a Human. Every team has the same problem: important signals buried in manual steps. Someone has to copy the alert from PagerDuty, pa…