Mindket

Local AI email classifier and reply drafter with Ollama

Newversion 1 · updated

Overview

An n8n workflow that labels each new email with a model running on your own computer through Ollama, drops spam and drafts a reply for the rest. Nothing is sent.

Local AI email classifier and reply drafter with Ollama 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
  • A local n8n on the same computer as Ollama: the default address works as it is
  • A self hosted n8n on a server: put Ollama on that server or its network, and change the address in both Ollama steps
  • An n8n in a container: use the address where Ollama can be reached, not localhost
  • n8n Cloud: not suited, because it cannot reach localhost on your computer

Platform

Connects 2 apps

How it works

Trigger

New unread email

It starts when an unread email arrives in the mailbox. Set first:

  • An IMAP credential
  • Ollama running with the llama3:8b model

Actions

  1. The IMAP node picks up each new unread email and marks it read
  2. Ollama labels the email as urgent, a question, feedback, spam or other, from its sender, subject and first lines
  3. Emails labeled SPAM are dropped
  4. Ollama writes a short, friendly reply for every other email
  5. The draft, the sender, the new subject and the label are gathered in one item for you to read

Result

A draft reply and a label for each email that is not spam, kept in the run data, with nothing sent

Integrations

What you need before you start.

Email (IMAP)

Mailbox

Starts a run for each new unread email.

NeedsIMAP details

Ollama

Language model

Labels each email and writes the draft reply on your own computer.

NeedsOllama with llama3:8b

Workflow check

Checked by Mindket on 13 Nov 2026

Steps
It has no trigger node, so a run reaches no step
API keys
No API key is left in the file

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

About

What it is

This n8n workflow sorts each new email with an AI model on your own computer and drafts a reply to every message that is not spam. It reads an inbox over IMAP, the standard way for a program to fetch mail, and asks Ollama to label each message as urgent, a question, feedback, spam or other. Spam is dropped. For the rest, a second request writes a short, friendly reply. The drafts stay in n8n for you to read. Nothing is sent. Five nodes run it.

Who it suits

People who want help with email but would rather not send their mail to an online AI service, such as freelancers, small offices and anyone who runs their own n8n server. It suits a mailbox where a first draft saves time and a person still decides. Skip it if you want replies sent for you, or if you need strong writing, because a small model on a home computer is less capable than the large online ones. Its cousins, Email replies drafted by AI and approved by email and Company knowledge email replies with approve or disapprove, use online models and send the reply after one click.

Who uses it, and how
IndustryWho uses itHow they use itExample
PrivacyFreelancersSort a busy inbox without sharing client mail with an online AIA freelancer lets Ollama label the morning’s mail and reads the urgent drafts first.
OfficesSmall officesGet first drafts for routine questionsAn office manager skims drafts for opening hours and price questions.
Self hostingHome lab ownersRun the whole chain on their own hardwareA hobbyist tests how a local model copes with real mail.
EducationTeachersDraft replies to routine questions from parentsA teacher reads drafts for questions about homework before sending anything.

You need an n8n that can reach Ollama, the llama3:8b model and one IMAP mailbox.

Where to use it

A local or self hosted n8n that can reach your Ollama will run it. n8n Cloud cannot reach an Ollama on your own computer.

  • A local n8n on the same computer as Ollama: the default address works as it is
  • A self hosted n8n on a server: put Ollama on that server or its network, and change the address in both Ollama steps
  • An n8n in a container: use the address where Ollama can be reached, not localhost
  • n8n Cloud: not suited, because it cannot reach localhost on your computer

Setup

Download saves a zip with workflow.json and Mindket’s setup notes in your downloads folder. Import the file, add one IMAP credential, check that Ollama has the model and switch the workflow on.

What you need first
NeedDetail
n8nLocal or self hosted, on the same computer or network as Ollama
OllamaInstalled and running, with llama3:8b downloaded
MailboxIMAP details for one account
ComputerRoom for a 4.7GB model
  1. In n8n, create a workflow, open its menu, choose Import from File and pick workflow.json.
  2. Add an IMAP credential to Email Trigger (IMAP).
  3. Check that Ollama is running and has llama3:8b.
  4. Both Ollama steps call http://localhost:11434/api/generate, which is Ollama’s own default address. If n8n cannot reach Ollama there, change the address in both steps.
  5. Save the workflow, switch it on and send a test email to the mailbox.

How to use it

Leave the workflow on. Each unread email gets a label and, unless it is spam, a draft. Open the Executions list, pick a run and read the fields of Prepare Draft for Review. Copy a draft into your mail app to send it.

What to change for a different result
To changeWhere
The labelsThe prompt in 1. Classify Email (Ollama)
The reply style and its sign offThe prompt in 2. Draft Reply (Ollama)
The modelThe name llama3:8b in both request bodies
How much of an email the model readsThe numbers in substring in both bodies
How long each step waitsThe timeout option of each Ollama step

Example

A freelance designer finds three emails after a night. One is a client asking whether Friday’s deadline still holds, one is a pitch from a stranger and one is a thank you note.

The workflow labels them QUESTION, SPAM and FEEDBACK, and the pitch stops there. In the morning she opens the run in the Executions list. The two drafts sit in draft_reply, each beside the sender, a subject that starts with Re: and its label. The draft for the client confirms the deadline, which the model could not know. She rewrites that line and sends both from her own mail app.

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. Ollama is a program that runs AI models on your own computer and answers requests at a local web address. IMAP is how a program reads an inbox. A trigger is the box that starts a run, and here it fires when an unread email arrives.

For experts. Both model steps are plain HTTP Request nodes against /api/generate, not the Ollama sub nodes.

Where to look closer
NodeWhat it doesWhat to know
Email Trigger (IMAP)Starts a run for each unread emailIts defaults are the INBOX, mark as read and the simple format. The body is in textPlain, not text
1. Classify Email (Ollama)Asks for one labelstream is false, so Ollama returns one JSON object and the answer is in response. Temperature 0.1, num_predict 20
Filter SpamDrops items labeled SPAMA notEquals test on the trimmed reply, ignoring case, so a reply with extra words passes
2. Draft Reply (Ollama)Writes the reply bodyTemperature 0.5, up to 1000 tokens, timeout 120 seconds
Prepare Draft for ReviewCollects the fields to readThe sender and subject come from the trigger, and the label from the first Ollama call

Good to know

It sends nothing, and the drafts exist only in the run data of n8n.

  • Output: nothing is sent and nothing is saved. Add a Gmail, Send Email or spreadsheet node after Prepare Draft for Review to use the drafts
  • Spam check: it is an exact match, so a reply such as SPAM. or Spam, because it sells something is not equal to SPAM, and that email is kept and drafted
  • Quality: a small model misreads emails sometimes and invents details in a reply, so read every draft
  • First call: Ollama loads the model on the first request and keeps it for five minutes by default. A slow computer may need longer than the 60 and 120 second timeouts for that call
  • Address: n8n Cloud cannot reach localhost on your computer, and an n8n in a container sees its own localhost. n8n’s Ollama notes suggest one user defined Docker network and http://<ollama-container>:11434
  • Model: ollama.com lists llama3:8b at 4.7GB with an 8K context window, read on 12 November 2026. Any other model Ollama lists works if you change its name in both steps
  • Repairs: the original copy had a schedule in front of the IMAP node and read a data field that does not exist. It also kept only spam and looked for a body field that the IMAP node does not give. Mindket’s copy fixes all four
  • Billing: there is no per use fee. The cost is your computer’s time and power
  • Your data: the email text goes to Ollama on your machine and not to an online AI service. Your mail provider and n8n still see every message
  • Credentials: the JSON holds none

README and files

README

Local AI email classifier and reply drafter with Ollama

An n8n workflow that labels each new email with an AI model on your own computer, then drafts a reply to every message
that is not spam. The model runs through Ollama, so the mail text never goes to an online AI service. The drafts stay in
n8n for you to read, and nothing is sent.

What is inside

  • workflow.json: the workflow as n8n exports it, 5 nodes and no sticky notes. It holds no credential.
  • README.md: these notes.

What we changed from the original copy

  • The workflow began with a schedule that ran every five minutes and fed an IMAP node set to fetch ten unread emails.
    The IMAP node of n8n is itself a trigger. It takes no input and has no such settings, so the schedule and the settings
    are gone. Email Trigger (IMAP) now starts each run, and the node is renamed from Get Unread Emails (IMAP).
  • The two Ollama steps read their answer with JSON.parse($json.data).response. The HTTP Request node already turns
    Ollama's JSON reply into fields, and there is no data field. They now read $json.response, which holds the
    model's text.
  • Filter Spam kept only the emails the model called SPAM and stopped everything else. It now drops them and lets the
    rest through.
  • The steps read the email body from text. The IMAP node's default format has no such field, so the model saw only the
    sender and the subject. They now read textPlain.

Before you start

  • An n8n instance on the same computer or network as Ollama, local or self-hosted.
  • Ollama installed and running, with llama3:8b downloaded. It is a 4.7GB model, so leave room for it.
  • One mailbox you can read over IMAP, with its server, port, user and password.

Set it up

  1. In n8n, create a workflow, open its menu, choose Import from File and pick workflow.json.
  2. Add an IMAP credential to Email Trigger (IMAP).
  3. Check that Ollama is running and has llama3:8b.
  4. Both Ollama steps call http://localhost:11434/api/generate, which is Ollama's own default address. If n8n cannot
    reach Ollama there, change the address in both steps.
  5. Save the workflow, switch it on and send a test email to the mailbox.

How a run goes

  1. Email Trigger (IMAP) watches the inbox. It fires for each unread email and marks it read, which are its own
    defaults. The fields used later are from, subject and textPlain.
  2. 1. Classify Email (Ollama) posts to Ollama's /api/generate. The prompt gives the sender, the subject and the first
    1000 characters of the body, and asks for one word in capitals, either urgent, question, feedback, spam or other. It runs with a
    temperature of 0.1, a cap of 20 tokens and a 60 second timeout.
  3. Filter Spam compares the reply with SPAM, ignoring case, and drops the email when they match.
  4. 2. Draft Reply (Ollama) asks the same model for a concise, friendly reply body, using the first 2000 characters of
    the email. It runs with a temperature of 0.5, a cap of 1000 tokens and a 120 second timeout. The prompt tells the
    model to sign off as the team.
  5. Prepare Draft for Review collects four fields: draft_reply, original_from, original_subject (the subject with
    Re: in front) and category.
  6. The run ends there.

Change the look

  • The labels: the list in the prompt of 1. Classify Email (Ollama).
  • The reply style and its sign off: the prompt of 2. Draft Reply (Ollama).
  • The model: the name llama3:8b in both request bodies.
  • How much of an email the model reads: the numbers in substring in both bodies.
  • How long each step waits: the timeout option of each Ollama step.

Good to know

  • The facts below come from pages and n8n source read on 12 November 2026.
  • Nothing is sent and nothing is saved. The drafts exist only in the data of each run, in the Executions list. Add a
    Gmail, Send Email or spreadsheet node after Prepare Draft for Review to use them.
  • The spam check is an exact match. A reply such as SPAM. or Spam, because it sells something does not equal SPAM,
    so that email is kept and drafted.
  • A small model on a home computer misreads emails sometimes and invents details in a reply. Read every draft.
  • Ollama loads the model on the first request and keeps it for five minutes by default. A slow computer may need more
    than the 60 and 120 second timeouts for that first call.
  • n8n Cloud cannot reach localhost on your computer. If n8n runs in a container, localhost points at that container.
    n8n's own Ollama notes suggest putting both containers on one user defined Docker network and using
    http://<ollama-container>:11434.
  • llama3:8b is listed at ollama.com as 4.7GB with an 8K context window. Any other model Ollama lists works if you
    change its name in both steps.
  • Billing: there is no per use fee. The cost is your computer's time and power.
  • Your data: the email text goes to Ollama on your machine and is not sent to an online AI service. Your mail provider
    and n8n still see every message.
  • Credentials: the JSON holds none.
Files
NOTICE.md  604 B
README.md  5 KB
workflow.json  5 KB

3 files, 10 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

Huashu Design

alchaincyf · Skill

Turns a one-line request in your AI agent into a finished design: a launch animation, a clickable app prototype, an editable slide deck, an infographic or a se…

New29.4k

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

Claude Code Skills & Plugins

alirezarezvani · Skill

Adds 411 ready-made skills for Claude Code and other coding agents, grouped by role from engineering and product to marketing, finance and compliance. Installs…

New29.8k

Similar in Productivity

See all in Productivity

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

upscaler

uwg · Kit

Holds a set of image upscaling models gathered from the OpenModelDB community, for people who want to enlarge low-resolution pictures with AI on their own comp…

New