This n8n tutorial builds a complete inbound email triage workflow, from the trigger through to a draft reply. Allow half a day for the first version and around 20 € a month in hosting. The case serves a small business receiving some forty emails a day on a shared mailbox, losing real time sorting them.
n8n is an open-source automation tool that wires your applications together. If the tool is new to you, our n8n guide for beginners covers the vocabulary and the nodes. Here, you build. Every step names the exact node, its settings and the pitfall that comes with it.
Email handling remains the most requested automation case in business. An artificial intelligence model reads a text, understands a request and proposes a reply. Those three operations are exactly what a shared mailbox demands all day long.

What you are going to build, and why it is a workflow
The workflow receives every inbound email and has a model classify it, into a closed list of categories. It logs the decision in a spreadsheet, routes the email to the right branch, then writes a draft reply. A human reviews and sends. Nothing leaves without validation.
This architecture follows hybrid logic. Fixed rules frame the path, and the model steps in only on the two stages that require understanding text. An autonomous agent would decide its actions as it goes. For a company inbox, predictability beats improvisation.

I set out this distinction in a LinkedIn post from March 2026 on workflows versus agents. Agents make people dream, workflows keep the business running. If what you need is an agent able to explore and chain unplanned actions, our tutorial on building an AI agent with n8n covers that case.
Three decisions to take before opening n8n
Three choices shape everything that follows, and revisiting them mid-build is expensive. Take them before creating the first node.
- Hosting. The community edition installs on your own server and costs only the machine. The managed offer starts at 20 € a month on annual billing. A small business without internal technical staff gains by starting on the managed offer, and can bring the workflow back in-house later.
- The model. Sorting an email into eight categories is a simple task. A small model is enough and costs a few cents per thousand emails. Keep the large model for writing the draft, where quality shows.
- The scope. One shared mailbox to begin with, the one that hurts most. Wiring three mailboxes at once multiplies edge cases before the categories have even settled.
Plan detail and real project cost live in two dedicated articles, n8n free or paid and the cost of an n8n automation project. This tutorial does not redo the price list, it simply costs this one workflow.
Step 1, trigger the workflow the moment the email lands
Two paths exist and they are not equivalent. The first uses the Gmail Trigger node, which checks the mailbox at a set interval. The second uses the Webhook node, fed by a forwarding rule set in the mail service. The second path is faster and markedly less greedy.
Setting up forwarding takes five minutes. Create a Webhook node, copy its production URL, then open the forwarding settings of your mail service. Add the address or URL supplied, confirm the verification message the service sends, and enable forwarding of a copy of incoming messages. Every email then fires the workflow within seconds.

The arithmetic is easy to check. Polling every five minutes means around 8,640 wake-ups over thirty days. Polling every quarter of an hour means 2,880. A mailbox receiving some forty emails per working day produces around 880 through forwarding. On the price list recorded in October 2026, the Starter plan includes 2,500 monthly executions for 20 € a month on annual billing.
Step 2, have the model classify the email
Add a Basic LLM Chain node and connect the model of your choice. Two settings make all the difference. The Prompt parameter switches to « Define below » so that you write the message yourself. And the « Require Specific Output Format » option is turned on, which reveals a connection point for a parser.
Three parsers connect at that point. Pick the Structured Output Parser and describe the expected schema to it. The parser appends formatting instructions to the message sent to the model, then validates the reply. Without it, you get free text and every downstream node becomes fragile.
| Field | What it holds | What it drives next |
|---|---|---|
| category | One value from the closed list | Feeds the Switch node |
| explanation | One sentence justifying the classification | Used to tune the prompt and brief the reviewer |
| reply_needed | Yes or no | Decides whether a draft gets written |
The system message always follows the same skeleton. You give a role, a few lines of company context, the exhaustive list of categories, and the instruction to file anything that fits nowhere under « other ». That catch-all category is deliberate. How full it gets will tell you which categories are missing.
Always ask for the explanation field. It does not serve the machine, it serves you. When an email lands in the wrong branch, the explanation tells you why, and you fix the category definition rather than fumbling with the whole prompt.
Step 3, log a week before automating a single action
Wire a Google Sheets node in append mode right after the classification, then activate the workflow and stop there. For one week, the workflow does nothing but watch and write. Each row carries the date, the sender, the subject, the chosen category and the model explanation.
This observation week is the part everyone skips, and it is the one that decides the quality of the result. You read three things in it. The share of emails filed under « other », which reveals missing categories. The recurring confusions between two neighbouring categories, fixed by sharpening their boundary. And the real volume per category, which tells you which ones deserve automation.
Step 4, route each category with the Switch node
The Switch node splits the flow into as many branches as you have categories. Leave the mode on « Rules » and write one rule per output, compared against the category field. One branch per category you automate, and nothing for the rest.
One setting deserves your attention, the « Fallback Output » option. It decides the fate of an item matching no rule. The default value, « None », makes it disappear silently. Switch it to « Extra Output », which creates an additional output where every unplanned case lands. Wire a notification to it. An email that vanishes silently is the most expensive failure to diagnose.
| Category | Automatic action | Draft written |
|---|---|---|
| Sales enquiry | Label, contact created in the CRM | Yes |
| Billing question | Label, invoice lookup | Yes |
| Technical support | Label, team notification | Yes |
| Supplier outreach | Label and archive | No |
| Other | Notification on the extra output | No |
Step 5, write a draft fed by the CRM
On the branches that deserve a reply, a second model call writes the draft. That second call receives more than the email. It also receives the customer record, pulled from your CRM by a lookup on the sender address. That enrichment is what separates a generic draft from one the reviewer keeps.
The build chains three nodes. A contact lookup by address, limited to one result. Retrieval of the open deal tied to that contact. Then the model call, to which you pass the relevant variables and only those. Amount due, date of last exchange, product subscribed. A whole record dumped into the message dilutes what matters.
The Gmail node then creates a draft, never a send. Two advanced settings keep the draft in the right thread, the reply and references headers, filled with the identifier of the original message. Without them the draft starts an isolated thread and the recipient loses the history.
Step 6, go to production without nasty surprises
Three safeguards are enough, and they take an hour to put in place. A dedicated error workflow, set in the main workflow settings, notifying the team as soon as an execution fails. The On Error setting on the model node, so a badly formed reply does not halt the whole flow. And a watch on the executions list during the first few days.
The most frequent error on this workflow reports that the model output does not match the required format. It happens when the model adds an introductory sentence before the structured block. The auto-fixing parser handles most of these cases, at the cost of a second model call.
On the invoice side, this workflow stays modest. Around 20 € a month for managed hosting, and a few euros of model usage for a thousand emails classified and two to three hundred drafts written. Human supervision costs more than the machine, and that is as it should be.
If your instance runs an older release, first read what changes with n8n version 2. Environment variables blocked in the code node and the new publishing paradigm change a few production habits.
Do you still need to write n8n workflows by hand?
Less and less, and that is the real novelty of this year. A coding agent connects to your instance through its programming interface. It generates a complete workflow, drops it on your account, reads the execution errors and fixes itself until the flow passes.
I detailed the setup in an edition of my newsletter, with the n8n connector installation, the project context file and the instance connection. The blank page disappears, and you spend your time on what actually matters, the list of categories and the review of drafts.
One reservation still holds. A generated workflow rarely works first time on the nodes touching your credentials and permissions. The gain lies in the structure. The final wiring stays on your plate.
Which n8n workflow should you start with in your business?
Start with inbound email triage, before reporting and before the agent. Three reasons for that. The volume is daily, so the gain shows within a week. The task is purely textual, so it lands squarely in what a model does well. And the risk stays contained, since the workflow produces a draft that somebody reviews.
Avoid the opposite, which is the most common pattern. An ambitious first project, wired to four tools, with no observation log and no « other » category. It breaks on the third edge case and nobody knows why.
Tandem has supported more than 50 companies on this kind of build, across around 100 engagements. Would you rather have the first workflow built than learn by doing it? our n8n support offer always starts from the same point, one mailbox, one week of logging, then automation.



