Mindket

Sort Outlook emails into folders with a local Ollama model

Newversion 1 · updated

Overview

An n8n workflow that sorts Outlook email with a local Ollama model. It sets a category on each unsorted email, then moves junk, receipts, SaaS and community mail to folders you pick.

Sort Outlook emails into folders with a local Ollama model is an n8n workflow in the Productivity category, listed by Mindket. It is free. This is version 1, last updated on . Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.

At a glance

Runs in
  • n8n on your own computer or server: the best fit, next to Ollama
  • n8n Cloud: works only if your Ollama server can be reached from the internet
  • On a schedule: swap the manual trigger for a Schedule Trigger to sort mail on its own
  • Other sorting rules: change the categories and folders to match your own mail

Platform

Connects 2 apps

How it works

Trigger

Manual run

You click Test workflow, and each click handles one email:

  • No input from you: it reads the next Inbox email that has no category and is not flagged

Actions

  1. Outlook returns one Inbox email that has no category and is not flagged
  2. The body is turned into plain text and trimmed to the subject, importance, senders and a cleaned body
  3. A local Ollama model (qwen2.5:14b) picks one category, an optional sub category and a short reason
  4. Outlook stores the category on the email
  5. Junk, receipt, SaaS and community emails move to their folders, and read action or business emails move to an Actioned folder

Result

An Outlook category on each email you click through, and a move to the folder that fits it

Integrations

What you need before you start.

Microsoft Outlook

Email

Returns the next unsorted Inbox email, sets its category and moves it to a folder.

NeedsA Microsoft Outlook OAuth2 credential and one folder each for junk, receipt, SaaS, community and actioned mail

Ollama

Local language model

Runs qwen2.5:14b on your own server and picks the category for each email.

NeedsA running Ollama server with qwen2.5:14b pulled

Workflow check

Checked by Mindket on 13 Nov 2026

Steps
25 steps, starting by hand
AI
1 step calls an AI model: Email category agent
Sign-ins
Signs in to: Microsoft Outlook and Ollama
API keys
No API key is left in the file
Step types
Mindket’s checker reads all 10 of its step types

Read from the workflow’s file, not from a run.

About

What it is

This n8n workflow sorts your Outlook inbox with an AI model that runs on your own computer. For each email that has no category, a local Ollama model picks one, and Outlook stores it. Junk, receipts, SaaS and community mail then move to folders you choose. Twenty-six nodes do the work, beside nine sticky notes.

Who it suits

Freelancers and small teams who get more email than they can read, and who do not want their mail sent to a cloud AI service. Skip it if you want a hosted model, since this one needs Ollama running on your own machine.

Who uses it, and how
IndustryWho uses itHow they use itExample
FreelanceIndependent developersLet a local model sort a busy inboxA developer sees receipts and junk filed away while client mail stays in the inbox.
ConsultingSmall agenciesKeep client email private while it is sortedAn agency runs the model on its own server, so no email text leaves the office.
SoftwareSaaS foundersSeparate account notices from real enquiriesA founder finds a billing notice under SaaS and a customer question under action.
EducationCourse organisersSort forum and event mailAn organiser sees community updates filed in their own folder.

You need a little n8n and a machine that can run a model of about 9 GB: import a file, install Ollama, add two credentials and pick five folders.

Where to use it

Any n8n that can reach your Ollama server and your Outlook mailbox will run it. The email text goes to your own server and to no outside AI service.

  • n8n on your own computer or server: the best fit, next to Ollama
  • n8n Cloud: works only if your Ollama server can be reached from the internet
  • On a schedule: swap the manual trigger for a Schedule Trigger to sort mail on its own
  • Other sorting rules: change the categories and folders to match your own mail

Setup

Download saves a zip with workflow.json and Mindket’s setup notes in your downloads folder. Create the Outlook folders first, so you can pick them in the Move nodes.

What you need first
NeedDetail
n8nOn your own computer or server
OllamaA running Ollama server with the qwen2.5:14b model pulled, about 9 GB
Microsoft OutlookA mailbox and an OAuth2 credential
Outlook foldersOne folder each for junk, receipts, SaaS, community and actioned mail
  1. In n8n, create a workflow, open its menu, choose Import from File and pick workflow.json.
  2. On the machine that runs Ollama, run ollama pull qwen2.5:14b.
  3. Add an Ollama credential with your server’s address, which is http://localhost:11434 by default, and select it in Ollama Chat Model.
  4. Add a Microsoft Outlook OAuth2 credential and select it in every Outlook node, which means Get emails without a category, the Set category nodes and the Move nodes.
  5. In Get emails without a category, open Filters and replace <YOUR_INBOX_FOLDER_ID> in Folders to Include by choosing your Inbox.
  6. In each node whose name starts with Move, choose its folder from the list.
  7. Click Test workflow. Each click handles one email.

How to use it

Click Test workflow and look at the email that was handled. It gets a category in Outlook, such as Junk or Action, and some emails also change folder. Each click handles one email, so click again for the next one.

What to change for a different result
To changeWhere
How many emails per clickLimit in Get emails without a category
The categoriesThe list in Add id and category list, the System Message in Email category agent and the rules in Route by category
Whose assistant it isSystem Message in Email category agent, which is written for a freelance developer
The foldersThe Move nodes
The modelModel in Ollama Chat Model
Running by itselfAdd a Schedule Trigger in front of Get emails without a category

Example

A freelancer clicks Test workflow. The next unsorted Inbox email is a receipt from an online shop. The model answers with the category receipt and a short reason.

Outlook then shows the category Receipt on the email, and the workflow moves it to the Receipt folder. A client enquiry would get the category Business, and would move to the Actioned folder only once it has been read.

For newcomers and experts

If you are new. n8n draws a workflow as boxes joined by lines, and each box, a node, does one job. This one reads an email, asks the model for a category, then follows the line for that category. Ollama is a program that runs AI models on your own computer.

For experts. The agent has no tools, so it is only a way to send the prompt. Parse agent reply cuts the JSON out of its answer, from the first curly brace to the last. An answer that is not valid JSON takes the error output to Catch parse errors, and the loop moves on.

Where to look closer
NodeWhat it doesWhat to know
Get emails without a categoryOutlook 2, Get Many, with a filter queryLimit 1, and the filter skips flagged emails and emails that already have a category
Convert body to textMarkdown 1, turns the HTML body into MarkdownPick email fields then strips links, images and symbols
Pick email fieldsSet 3.4, keeps the subject, importance, senders and a cleaned bodyThe cleaning is a chain of replace calls in one expression
Add id and category listSet 3.4, adds the email id and the allowed categoriesThe categories sit in one string that the prompt reuses
Email category agentAgent 1.6 with a system message and no toolsThe Ollama model runs at temperature 0.2
Parse agent replySet 3.4, turns the reply into an objectIts error output leads to Catch parse errors
Route by categorySwitch 3.2 with six rules and a fallbackMatching ignores case, and the fallback takes the other category
Is email readIf 2.2, checks the read flagRead action and business emails move on to the Actioned folder
Merge outcomesMerge 3 with seven inputsEvery branch ends here, then the loop continues

Good to know

The original needed a few fixes before it could work for anyone else, and it still needs a local model that can keep up.

  • Your own folders: the original pointed at its author’s mailbox folders by id. Mindket’s copy leaves the folder pickers empty, and the Inbox filter holds <YOUR_INBOX_FOLDER_ID>, so Outlook rejects the request until you pick your own Inbox
  • The model: the Ollama library page for qwen2.5, read on 12 November 2026, lists the 14b model at 9.0 GB with a 32K context window and a tools tag
  • Context: Ollama’s documentation gives 4,096 tokens as the default context under 24 GiB of video memory, so a long email may be cut unless you raise Context Length on Ollama Chat Model
  • One email per click: Limit is 1, so a bigger inbox needs many clicks or a higher limit
  • A failed parse: an email whose answer never parses stays without a category, so the next click can pick it up again
  • Category names: Outlook receives them with a capital first letter, such as Junk and SaaS
  • Whose assistant: the system message is written for a freelance developer, so rewrite it for your own work
  • Your data: the email text goes to your own Ollama server, and the mail itself stays in Microsoft’s service
  • Credentials: the JSON holds none, so add the Ollama and Microsoft Outlook credentials yourself

README and files

README

Sort Outlook emails into folders with a local Ollama model

An n8n workflow that sorts Outlook email with an AI model on your own computer. For each email that has no category, a local Ollama
model picks one and Outlook stores it. Junk, receipt, SaaS and community mail then move to folders you choose.

What is inside

  • workflow.json: the workflow as n8n exports it, twenty-six working nodes and nine sticky notes. It holds no credential.
  • README.md: these notes.

What we changed from the original copy

  • The original pointed at the folders of its author's own mailbox by id. Every Move node now shows an empty folder picker, and
    the Inbox filter in Get emails without a category holds <YOUR_INBOX_FOLDER_ID>.
  • The Outlook and helper nodes had names such as Microsoft Outlook12 and varJSON1. They now say what they do, for example
    Set category junk and Parse agent reply, and every expression that named one was updated.
  • The sticky note with its author's byline and the one with a video were removed or rewritten, and the other sticky notes were
    reworded.
  • The model, the prompt and the routing are as the original has them.

Before you start

  • An n8n instance on your own computer or server.
  • An Ollama server with the qwen2.5:14b model pulled, about 9 GB.
  • A Microsoft Outlook mailbox and an OAuth2 credential for it.
  • Outlook folders for junk, receipt, SaaS, community and actioned mail.

Set it up

  1. In n8n, create a workflow, open its menu and choose Import from File. Pick workflow.json.
  2. On the machine that runs Ollama, run ollama pull qwen2.5:14b.
  3. Add an Ollama credential with your server's address, http://localhost:11434 by default, and select it in
    Ollama Chat Model.
  4. Add a Microsoft Outlook OAuth2 credential and select it in every Outlook node: Get emails without a category, the
    Set category nodes and the Move nodes.
  5. In Get emails without a category, open Filters and replace <YOUR_INBOX_FOLDER_ID> in Folders to Include by choosing
    your Inbox.
  6. In each node whose name starts with Move, choose its folder from the list.
  7. Click Test workflow. Each click handles one email.

How a run goes

  1. Get emails without a category asks Outlook for one Inbox email that is not flagged and has no category.
  2. Convert body to text and Pick email fields reduce it to a subject, importance, senders and a cleaned body.
  3. Add id and category list adds the email id and the allowed categories.
  4. Email category agent asks the Ollama model for a category, an optional sub category and a short reason.
  5. Parse agent reply turns the answer into an object. An answer that is not valid JSON goes to Catch parse errors.
  6. Route by category picks the branch. Each Set category node writes the category and sub category in Outlook.
  7. Junk, receipt, SaaS and community emails then go to their Move node. Action and business emails go through
    Is email read, and a read one moves to the Actioned folder.
  8. Merge outcomes joins the branches and the loop starts again.

Change the look

  • How many emails per click: Limit in Get emails without a category.
  • The categories: the list in Add id and category list, the System Message in Email category agent and the rules in
    Route by category.
  • Whose assistant it is: System Message in Email category agent.
  • The folders: the Move nodes.
  • The model: Model in Ollama Chat Model.

Good to know

  • The Ollama library page for qwen2.5, read on 12 November 2026, lists the 14b model at 9.0 GB with a 32K context window and
    a tools tag.
  • Ollama's documentation gives 4,096 tokens as the default context under 24 GiB of video memory, so a long email may be cut
    unless you raise Context Length on Ollama Chat Model.
  • Limit is 1, so each click handles one email.
  • An email whose answer never parses stays without a category, so the next click can pick it up again.
  • The system message is written for a freelance developer. Rewrite it for your own work.
  • The email text goes to your own Ollama server, and the mail itself stays in Microsoft's service.
Files
NOTICE.md  615 B
README.md  4 KB
workflow.json  34 KB

3 files, 39 KB, downloaded as a zip.

What’s new

  • Version 1 · 2026-11-12

Reviews

No ratings yet

Write a review

No reviews yet.

More from Mindket

See all from Mindket

anaksor-ocr

Sokheng · Kit

Reads Khmer and English text from documents, receipts and photos of signs, using a detector for text lines and a recogniser for each line. Suits developers who…

New

Qwen2.5-7B-Instruct as GGUF files in eight quantization sizes, to chat with locally through llama.cpp. For people who want a capable 7.6B model on their own co…

New

ACE-Step 1.5 XL SFT

ACE-Step · Kit

Generates music from text with a 4B diffusion decoder, 50 steps and guidance control, aiming for higher audio quality than the base. For creators with a GPU of…

New

Similar in Productivity

See all in Productivity

Guizang PPT Skill

op7418 · Skill

Skill that makes single-file HTML slide decks, slide illustrations and platform covers in two visual styles, with a presenter mode for rehearsal. For speakers…

New29.8k

Frontend Slides

zarazhangrui · Skill

Builds HTML presentations from scratch or from a PowerPoint file and shows visual style previews to pick from, for people who want web slides with no CSS or Ja…

New32.3k

IPTV

iptv-org · Kit

Collects publicly available live TV channels from many countries into playlists that any video player with live streaming can open. Made for viewers and for de…

New144k