Skip to main content

Automatic email categorization and organization with Outlook and GPT-4o

Workflow preview

Workflow preview
100%
Automatic email categorization and organization with Outlook and GPT-4o preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

n8n – Outlook AI Categorization & Labeling (Fully Automated) Zero manual mapping. The workflow automatically discovers your Outlook folders, understands the context, assigns the correct catego...

Best for

  • Ticket Management automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.splitinbatches, n8n-nodes-base.markdown, n8n-nodes-base.set, n8n-nodes-base.filter, n8n-nodes-base.if, @n8n/n8n-nodes-langchain.agent, n8n-nodes-base.merge

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Can KURT.

Original n8n.io source

1.1 Workflow description

Title
Automatic email categorization and organization with Outlook and GPT-4o
Workflow name
Automatic email categorization and organization with Outlook and GPT-4o

n8n – Outlook AI Categorization & Labeling (Fully Automated)

> Zero manual mapping. The workflow automatically discovers your Outlook folders, understands the context, assigns the correct category, and moves the email into the right folder. It uses the original Microsoft Outlook nodes plus an AI Agent. You can connect OpenAI or any other LLM provider.


✨ Features

  • Self-Discovery: Scans your Outlook folders automatically – no manual mapping required.
  • AI-Powered Decisions: Considers sender, subject, content, links, attachments, timing, and business context.
  • Label + Move: Assigns the right Outlook category and moves the email into the correct folder.
  • Dual Category Logic: Can apply both a primary and a secondary category (e.g., Action + Project).
  • Error Handling: Captures errors and continues without breaking the workflow.
  • Flexible AI Backend: Replace OpenAI with your own LLM if preferred.

🚀 Setup (5 Steps)

  1. Connect Outlook
    In n8n → Credentials → Microsoft Outlook, grant at least Mail.ReadWrite.

  2. Connect AI
    In n8n → Credentials, set up OpenAI (or another model). Works best with GPT-4.x or GPT-4o.

  3. Import the Workflow
    n8n → Workflows → Import from File/Clipboard and paste the provided JSON.

  4. Enable Trigger
    Adjust the Schedule Trigger (e.g., every 5 minutes).

  5. Run & Verify
    Test run and watch emails get categorized and moved automatically.


🧠 How It Works

  1. Schedule Trigger pulls new emails
  2. Loop Over Items processes them one by one
  3. Markdown / varEmail cleans the content
  4. Get Many Folders fetches Outlook categories and folders
  5. Summarize + Code prepare category IDs
  6. AI Agent applies deep categorization logic
  7. Update Category applies the Outlook category
  8. Move Folder places the email in the right folder
  9. Error Handling ensures workflow stability

🧩 System Prompt Example

You are an advanced AI email categorization system. Your mission is to intelligently analyze and categorize emails with maximum accuracy and context awareness.

INTELLIGENT CATEGORIZATION ENGINE:

- Parse all available categories: {{ $json.category }}
- Multi-layer analysis: Sender, Subject, Body, Links, Attachments
- Prioritize: Security threats, Action Required, Business Context
- Specialized: SaaS, Hosting, E-commerce, Finance, Support, Corporate
- Anti-Spam: Pattern detection, spoofing, red-flag subjects
- Dual Logic: Primary + Secondary categories when applicable

OUTPUT FORMAT (JSON only):
{
  "subject": "EXACT_EMAIL_SUBJECT",
  "category": "PRIMARY_CATEGORY_FROM_AVAILABLE_LIST",
  "subCategory": "SECONDARY_CATEGORY_IF_APPLICABLE",
  "analysis": "Reasoning",
  "confidence": "HIGH/MEDIUM/LOW"
}

Available Categories: {{ $json.category }}

⚙️ Parameters & Notes

  • Uses only existing Outlook categories (never invents new ones).
  • Works with any LLM that supports Chat Completions.
  • Requires Mail.ReadWrite permissions.
  • Safe fallback: if unsure, it uses the Action category.

🛡️ Security

  • Processes only what is needed for classification.
  • No external logging of email content unless you configure it.
  • AI provider can be swapped for self-hosted LLMs for compliance.

📄 License & Sharing

  • License: MIT (or your choice).
  • Tags: n8n, Outlook, Email, AI, Automation, Categorization
  • Import Method: Copy/paste workflow JSON into n8n.

✅ Summary

Connect → Import → Run.
No manual mapping. AI-powered categorization that labels and organizes your Outlook mailbox automatically.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Sticky Note8

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - Loop Over Items1

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 3 - Markdown1

Type / Role
n8n-nodes-base.markdown - markdown
Config choices
Version 1

Block 4 - varEmal1

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 5 - Filter1

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Block 6 - If1

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 7 - Catch Errors1

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 8 - varJSON1

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 9 - AI Agent1

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.6

Block 10 - Merge1

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3

Block 11 - Code

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 12 - Get many folders

Type / Role
n8n-nodes-base.microsoftOutlook - microsoftOutlook
Config choices
Version 2

Block 13 - Summarize

Type / Role
n8n-nodes-base.summarize - summarize
Config choices
Version 1.1

Block 14 - VarID Category

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 15 - Get many folders1

Type / Role
n8n-nodes-base.microsoftOutlook - microsoftOutlook
Config choices
Version 2

Block 16 - If

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 17 - Schedule Trigger

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 18 - RecievedEmail

Type / Role
n8n-nodes-base.microsoftOutlook - microsoftOutlook
Config choices
Version 2

Block 19 - Update Category

Type / Role
n8n-nodes-base.microsoftOutlook - microsoftOutlook
Config choices
Version 2

Block 20 - Move Folder

Type / Role
n8n-nodes-base.microsoftOutlook - microsoftOutlook
Config choices
Version 2

Block 21 - OpenRouter Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

Block 22 - AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.6

Block 23 - OpenRouter Chat Model1

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

3. Summary Table

Workflow Automatic email categorization and organization with Outlook and GPT-4o
Complexity advanced
Nodes 23
Categories Ticket Management, AI Summarization
Author Can KURT
Published 06 Sept 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/8336/8336.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automatic email categorization and organization with Outlook and GPT-4o do?

n8n – Outlook AI Categorization & Labeling (Fully Automated) Zero manual mapping. The workflow automatically discovers your Outlook folders, understands the context, assigns the correct catego...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Ticket Management, AI Summarization use case.