Automate email triage with n8n
Set up an n8n workflow that sorts incoming emails by type and routes them to the right place — so client leads don't get lost in the noise.
Last checked 22 October 2026
What you'll make
An automated email sorting workflow that reads incoming emails, classifies them by type (client lead, customer support, newsletter, spam), and routes each type to the right destination — a Slack notification for leads, a support inbox for queries, and the archive for everything else.
What you need
- An n8n account (the free cloud tier works for this — or self-host if you have it)
- An email account connected to n8n (Gmail or IMAP)
- A Slack workspace (optional — for lead notifications; you can use email instead)
- 45 minutes
Steps
- In n8n, create a new workflow and add an email trigger:
Add a "Email Trigger (IMAP)" or "Gmail Trigger" node. Set it to check for new emails every 5 minutes. For Gmail, connect your account and select the inbox to monitor.
- Add an AI classification node. In n8n, use the "OpenAI" node (or any AI node you have connected) to classify each email:
Add an OpenAI node after the trigger. Set the prompt to:
"Read this email subject and body. Classify it into one of these categories:
- LEAD: someone asking about hiring me, buying a service, or requesting a quote
- SUPPORT: an existing customer asking for help or reporting an issue
- NEWSLETTER: a marketing email, digest, or automated notification
- OTHER: anything that doesn't fit the above
Respond with only the category name, nothing else.
Subject: {{$json.subject}}
Body: {{$json.textPlain}}"
- Add a Switch node to route based on the category:
Add a Switch node connected to the OpenAI node's output. Create 4 rules:
- Rule 1: if the AI output equals "LEAD", route to output 1
- Rule 2: if the AI output equals "SUPPORT", route to output 2
- Rule 3: if the AI output equals "NEWSLETTER", route to output 3
- Rule 4: default, route to output 4
- Set up the destination for each route:
Output 1 (LEAD): Add a Slack node. Send a message to a channel called "#leads" with the email subject, sender and a link to the full email. Format: "New lead from [sender]: [subject]"
Output 2 (SUPPORT): Add a Gmail node. Apply a label called "Support" and mark it as unread so it stands out in your inbox.
Output 3 (NEWSLETTER): Add a Gmail node. Apply a label called "Newsletter" and archive it (remove from inbox).
Output 4 (OTHER): Add a Gmail node. Archive it.
Test the workflow. Send yourself 4 test emails — one that looks like a lead, one like a support request, one like a newsletter, and one random. Check that each gets routed to the right place.
Activate the workflow. n8n will now check every 5 minutes and sort incoming email automatically.
Check your result
- A test lead email triggers a Slack notification (or whatever lead destination you chose)
- A test support email gets labelled and stays in your inbox
- A test newsletter gets labelled and archived
- The AI classification is accurate for your typical email types (check the first week's routing manually)
If the AI misclassifies emails often, refine the prompt. Add examples: "A lead looks like: 'Hi, I saw your website and I'm interested in a quote for...' A support email looks like: 'I bought your course last month and I can't access...'" The more specific your examples, the better the classification.
Get the next skill when it’s out
Something here out of date? Tell us.