PICKED FROM N8N.IO · EMAIL & INBOX

Fetches unflagged, uncategorised emails from Outlook, strips the HTML and passes each one to an AI agent running on Ollama. The model assigns a category such as Action, Junk, Business or SaaS. The workflow applies the category in Outlook and moves messages like junk or receipts to the matching folders.

Template by Wayne Simpson · 74.2k views on n8n.io · listed there as “Auto categorise Outlook emails with AI”

THE WORKFLOW26 NODES
MWhen clicking‘Test workflow’LOllama ChatModel1MMicrosoftOutlook10MMicrosoftOutlook12SLoop Over Items1MMicrosoftOutlook13MMicrosoftOutlook15MMicrosoftOutlook16MMicrosoftOutlook17MMicrosoftOutlook18MMicrosoftOutlook19MMarkdown1≡varEmal1MMicrosoftOutlook20MMicrosoftOutlook21▽Filter1⑂If1MMicrosoftOutlook22≡Catch Errors1≡varJSON1MMicrosoftOutlook23≡varID & Category1MMicrosoft OutlookMove Message1✦AI Agent1⋈Merge1⑂Switch1
DIFFICULTY
Advanced
NODES
26
USES AI
Yes
PUBLISHED
October 2024

001 / WHAT HAPPENS

  1. 01

    Emails are fetched from Outlook, skipping flagged ones and those already categorised.

  2. 02

    Each email is converted to plain Markdown to remove HTML clutter.

  3. 03

    An AI agent using an Ollama model picks a category and returns it as JSON.

  4. 04

    A Switch step matches the category to the right Outlook action.

  5. 05

    The email is categorised and moved to folders such as Junk Email or Receipts.

WHO IT SUITS

Suits busy owners or admin staff on Microsoft 365 who want their inbox sorted, and who can run or replace a local Ollama model.

CONNECTS

  • Microsoft Outlook
  • Ollama

002 / BEFORE YOU USE IT HERE

  • !It uses an Ollama model, which needs a self-hosted server you run yourself; email content stays on that server, though swapping to a hosted AI model sends it overseas under APP 8.
  • !It moves emails to Junk automatically, so check categories on a small batch first in case real customer emails are misfiled.
  • !Category names appear in several nodes and must match exactly; customise them for your business.

LOCAL SWAP

Swap the Ollama chat model for an OpenAI chat model if you do not self-host.

Need n8n and the AI hosted in Australia? →

004 / QUESTIONS

Anything else is quicker to answer on a call. Thirty minutes, free, with the people who would build it.

Yes. Every template on this list is free on n8n.io. You need an n8n account (n8n Cloud or self-hosted) and accounts for the apps it connects to, some of which charge for API use.

We adapt templates to your systems, add approval steps where customers are involved, host n8n in Australia when the data calls for it and hand it over documented.

Book a free call→