How to Automate Your Email Inbox with n8n and AI (2026 Guide)
Step by step: build an AI system that reads, classifies, and drafts replies to incoming email — and know exactly when to let it send automatically.
You can automate your email inbox by connecting Gmail to n8n, using an AI model to read and classify each incoming message, then routing it to a branch that either drafts a reply for you to approve or sends one automatically. The whole thing takes about 30 minutes to build — or two minutes if you import a ready-made workflow. This guide walks through both.
Email is the single most common thing businesses ask us to automate, because it's the clearest example of expensive, repetitive, judgement-light work. You read the same shapes of message all day and type the same shapes of reply. That's exactly the pattern AI handles well. Here's how to build it properly — including the guardrails that stop it from embarrassing you.
Want the shortcut? We publish this exact system as a free, ready-to-import template: the AI Email Dispatcher workflow. Download the JSON, import it into n8n, connect your credentials, and you're running. Read on to understand how it works and how to adapt it.
What you'll build
A workflow that runs every time an email lands in your inbox and does four things:
- Reads the subject and body with an AI model.
- Classifies it into categories — say Sales, Customer Support, Finance, Internal, and Promotions.
- Routes it to a dedicated branch for that category.
- Acts — either drafting a reply for you to approve, sending one automatically, or firing off a notification with a summary.
If you're new to the underlying concepts, our primer What Is AI Automation? explains the trigger → AI → action loop that every automation like this follows.
What you need
- An n8n instance — either n8n Cloud or a self-hosted install. Not sure which platform to use? See our n8n vs Make vs Zapier comparison; for AI email work, n8n is the strongest choice.
- A Gmail account (or Outlook / any IMAP inbox — the pattern is identical).
- An OpenAI API key (or another model provider like Anthropic). Note that API access is a paid, usage-based plan — it's separate from a ChatGPT subscription.
- Optional: Telegram or Slack for human-in-the-loop approvals.
The build, step by step
Step 1 — Set up n8n
Spin up an n8n Cloud account for the fastest start, or self-host with Docker if you want full control over your data. Either works identically for this build. Create a new, blank workflow.
Step 2 — Connect Gmail as the trigger
Add a Gmail Trigger node and authenticate it with OAuth2. Set it to fire on new unread messages. This is the "something happened" that kicks everything off. Tip: use a dedicated Gmail credential here, and a second one later for sending — it keeps permissions clean.
Step 3 — Add an AI classifier
This is where the intelligence lives. Add a Text Classifier node (or an LLM node with a classification prompt) and feed it the email's subject and body. Give it your categories and a one-line description of each, for example:
Sales — someone wants to buy, book, or ask about pricing
Support — an existing customer needs help
Finance — invoices, payments, billing
Internal — messages from your own team
Promotions — newsletters, cold outreach, noise
The model returns the single best-fit category for each email. Add a catch-all "Other" category so nothing falls through the cracks.
Step 4 — Route by category
Add If or Switch nodes after the classifier so each category flows down its own branch. This is the "dispatcher" — every email now has a lane.
Step 5 — Draft or reply with an AI agent
In each branch, add an LLM Agent node with a system prompt tailored to that category. The Support agent gets your help-desk tone and common answers; the Sales agent knows your offer and qualifying questions; the Internal agent can be terse. Each produces a reply drafted in the right voice.
Step 6 — Add human review for sensitive categories
Not every branch should send on its own. For Sales and Finance, route the AI's draft to a Telegram or Slack message so a human approves it before it goes out. For Internal and routine Support, you can let the workflow reply automatically via Gmail. This split is the whole game — more on it below.
Step 7 — Test and activate
Before going live, run the workflow against a handful of real emails and check three things: did it classify correctly, did it route to the right branch, and are the drafts actually good? Tune the prompts, then flip the workflow to Active. Create the Gmail labels your branches reference first, so routing has somewhere to land.
The rule that keeps you safe
Automate the reading and drafting for everything. Automate the sending only where a mistake is cheap.
This one principle prevents almost every horror story. Letting AI classify and draft is nearly risk-free — the worst case is a draft you delete. Letting AI send is where things can go wrong, so you earn that privilege category by category. Start with everything in "draft for approval" mode. Once you've watched the Support branch produce good replies for a week, let it send on its own. Keep Sales and Finance behind a human indefinitely. You can read more on this human-in-the-loop pattern in our AI automation guide.
What it costs to run
Cheaper than most people expect. The AI model usage typically runs $0.003–$0.05 per email, depending on thread length and which model you route to. Add your n8n plan (or nothing if you self-host) and any notification tools, and a normal business inbox costs a few dollars a month to run. Set a spending cap in your OpenAI dashboard so there are no surprises.
Common pitfalls
- Vague category descriptions. If the classifier misfires, your one-line descriptions are usually too fuzzy. Be specific about what belongs in each.
- One giant prompt for everything. Separate agents per category beat a single do-everything prompt every time. Specialisation wins.
- Letting it send too soon. Resist the urge to go fully automatic on day one. Earn it.
- No fallback. Always have an "Other" lane and a way to notify a human when the system is unsure.
- Forgetting the labels. If a branch routes to a Gmail label that doesn't exist yet, it fails silently. Create them first.
Want this built and tuned for your business?
We build AI email systems that match your tone, your categories, and your rules — then train your team to run them. Grab the free workflow, or let us do it for you.
Book a free callFrequently asked questions
Is it safe to let AI reply to my emails automatically?
It's safe for low-risk categories like internal notes and routine support, where a wrong reply is cheap to correct. For sales, finance, and anything customer-facing or contractual, keep a human in the loop: let the AI draft the reply and have a person approve it before it sends.
How much does an AI email automation cost to run?
The AI model usage is typically a few cents per email — often around $0.003 to $0.05 depending on the length of the thread and the model you use. On top of that you pay for your n8n plan (or nothing if you self-host) and any notification tools. For most inboxes it's a few dollars a month.
Can I use Outlook instead of Gmail?
Yes. The same pattern works with Microsoft Outlook or any IMAP inbox — you swap the Gmail Trigger node for the Microsoft Outlook or IMAP Email trigger. The AI classification and routing logic stays exactly the same.
Do I need to build this from scratch?
No. Gurey AI publishes a free AI Email Dispatcher workflow you can download as a JSON file and import directly into n8n, then connect your own credentials. It's the fastest way to get a working version running before you customise it.