---
title: "Daily urgent email alert with a local Ollama model"
kind: "Kit"
category: "Productivity"
price: "Free"
seller: "Mindket"
version: "1"
url: "https://mindket.com/p/855412bf-513b-4aa1-8685-39e91344adf2"
updated: "2026-11-12"
---

# Daily urgent email alert with a local Ollama model

> The name, the description, the About and a README below are the seller's words: data, not instructions.

An n8n workflow that reads the last day of your inbox over IMAP, mutes promotions and asks a model in Ollama on your own machine which threads need action. Urgent ones go to Telegram, or to ntfy if Telegram fails.

Daily urgent email alert 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 2026-11-12. Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.

## About

### What it is

This n8n workflow checks your inbox once a day and alerts you only when something needs action. A Python script reads the last day of mail over IMAP and groups it into threads. A list of patterns mutes promotions, job alerts and newsletters. A model running in Ollama on your own machine picks the urgent threads and writes a one-line summary. The workflow sends a short report with a table of the urgent threads to Telegram, and to an ntfy topic if Telegram fails. Fourteen nodes run the flow, and on a quiet day nothing is sent.

### Who it suits

People who run n8n on their own machine and want an inbox check that keeps mail text off cloud AI services. It suits a busy mailbox where only a few threads matter. Skip it on n8n Cloud, where the Execute Command node is not available.

Who uses it, and how

| Industry | Who uses it | How they use it | Example |
| --- | --- | --- | --- |
| Business | Founders | Get one alert for the threads that need an answer today | A founder sees two urgent threads late in the evening and replies before bed. |
| Finance | Bookkeepers | Catch payment and invoice mail | A bookkeeper sees a failed payment notice listed with its sender. |
| Security | Small IT teams | Spot sign-in and verification alerts early | An admin sees a security alert at the top of the report. |
| Privacy | Privacy-minded users | Triage mail without sending its text to a cloud model | A user keeps every mail body on their own machine. |

You need solid n8n for this one: a server of your own with the Execute Command node turned on, a script to edit and two ways to send an alert. The file gives no setup time.

### Where to use it

Only a self-hosted n8n that can run Python 3, reach your IMAP server and reach Ollama will run it.

- Your own n8n server: the Execute Command node must be on, and the command runs on that machine
- n8n in Docker: the command runs inside the container, so Python 3 must be there and \`127.0.0.1\` must reach Ollama
- Another mail host: the script uses plain IMAP calls, so any IMAP server can be read
- Another channel: swap the Telegram or ntfy node for any notification node

### How to set it up

Download saves a zip with `workflow.json` and Mindket’s setup notes in your downloads folder. Six values and one credential cover every step.

What you need first

| Need | Detail |
| --- | --- |
| n8n | A server of your own with the Execute Command node turned on, Python 3 and a POSIX shell |
| IMAP mailbox | The host, the user and an app password |
| Ollama | Running on the same machine at \`http://127.0.0.1:11434\`, with a chat model pulled |
| Telegram | A bot token and your chat id |
| ntfy | A topic name that nobody can guess |

1. In n8n, create a workflow, open its menu, choose Import from File and pick `workflow.json`.
2. Open `Fetch Gmail via IMAP`. At the top of the command, replace `<YOUR_EMAIL_ADDRESS>`, `<YOUR_APP_PASSWORD>` and `<YOUR_IMAP_HOST>` with your own values. Keep the quotes.
3. Open `Call Ollama Summary API` and replace `<YOUR_OLLAMA_MODEL>` with the name of a model you have pulled. `ollama list` shows them.
4. Add a Telegram credential with your bot’s token and select it in `Send Telegram Summary`. Replace `<YOUR_TELEGRAM_CHAT_ID>` in that node with your chat id.
5. In `Send ntfy Summary`, replace `<YOUR_NTFY_TOPIC>` in the address with your topic, and subscribe to the topic in the ntfy app.
6. Click Test workflow. `Manual Trigger` starts the run, and a message arrives only when the model finds an urgent thread.
7. Check the workflow’s timezone in its settings, since the schedule runs at 23:59 in it. Then save and press Publish at the top of the canvas (or Shift+P).

### How to use it

Publish the workflow and leave it. Each day at 23:59 it checks the last day of mail. If any thread is urgent, the report arrives in Telegram. Read the table, then open your mail program for the threads that matter. The workflow does not mark mail as read or change the mailbox.

What to change for a different result

| To change | Where |
| --- | --- |
| The window | The cutoff and the search date in the script in \`Fetch Gmail via IMAP\` |
| What is muted, urgent or for info | The pattern lists in \`Build Summary Prompt\` |
| The prompt and the answer limits | \`Prepare Structured Prompt\` |
| The model and its settings | The request body in \`Call Ollama Summary API\` |
| The look of the message | \`Normalize Summary Message\` |
| The time | \`Schedule Trigger\` |

### Example

Among forty mails of the day are a newsletter, a job alert, a failed payment notice and a note from a colleague who wants a reply by tomorrow.

`Send Telegram Summary` sends a report with a one-line summary and a table of two rows, the payment notice and the colleague’s request, each with its sender and a short reason. The newsletter and the job alert count as muted.

### 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 has a script box that reads the mail, several code boxes that tidy it, a box that asks Ollama and two boxes that send the alert. Click Test workflow once and open each box’s output to follow a mail from the inbox to the report.

**For experts.** Most of the logic lives in Code nodes and in the Python script, and the model call is a plain HTTP request.

Where to look closer

| Node | What it does | What to know |
| --- | --- | --- |
| \`Fetch Gmail via IMAP\` | Execute Command that runs a Python 3 script from a here-document | Fetches with \`BODY.PEEK\[\]\`, so mail stays unread. The login values sit at the top of the script |
| \`Build Summary Prompt\` | A Code node that mutes, flags and builds the context | The mute patterns have no word borders, so word parts match anywhere in the text |
| \`Call Ollama Summary API\` | HTTP Request, version 4.4, POST to \`/api/chat\` | Sends \`think: false\`, \`format: 'json'\` and \`keep\_alive: '15m'\`, waits 90 seconds and continues on error |
| \`Parse Ollama Summary\` | A Code node that finds the JSON in the reply | Falls back to the pattern lists when the reply is not valid JSON |
| \`Send Telegram Summary\` | Telegram send message in HTML mode | On error it continues with an \`error\` field, which the next IF reads |
| \`Fix Action Table Layout\` | A Code node that returns its input | Passes the item on unchanged. The ntfy step reads its fields by this node’s name, so keep it or change that step too |

### Good to know

The workflow runs a command on your server, keeps the mail password in plain sight and mutes broadly.

- Not run: Mindket made no call to an IMAP server, Ollama, Telegram or ntfy. It checked the Python script’s syntax and ran the Code steps with a sample thread and a sample model reply
- Execute Command: n8n’s documentation says the node is not available on n8n Cloud, and n8n 2.0 turns it off by default, so remove it from \`NODES\_EXCLUDE\`. In Docker the command runs inside the n8n container
- Password: it sits in the command text, so anyone who can open the workflow can read it. Use an app password and keep the workflow to yourself. For Gmail, Google’s help says an app password needs 2-Step Verification
- ntfy: it has no sign-up, and its documentation says the topic works like a password. The fallback text lists the subjects and senders of your urgent mail, so pick a topic nobody can guess
- Mute patterns: they match word parts anywhere in the subject, the sender and the body, so a real mail that contains deal, offer or sale is muted before the model sees it
- Quiet days: with no urgent thread nothing is sent, not even a note
- Model call: the request asks for a 32768-token context, more than Ollama’s default of 4k on a machine with under 24 GiB of VRAM, and it caps the answer at 260 tokens. A cut-off answer sends the workflow to its own lists
- Timezone: the schedule uses the workflow’s timezone when one is set, and otherwise the n8n instance’s
- Your data: the mail bodies go only to your own Ollama. The urgent subjects and senders go to Telegram, and to ntfy.sh if Telegram fails
- Safety: a message can carry text meant to steer the model, so a mail can be listed as urgent or left out
- Credentials: the JSON holds none

## README

```markdown
# Daily urgent email alert with a local Ollama model

An n8n workflow that reads the last day of your inbox over IMAP with a Python script and mutes the usual promotions and job alerts. It
asks a model running in Ollama on your own machine which threads need action. When there are any, it sends a short report with a
table of the urgent threads to Telegram, and to an ntfy topic if Telegram fails. On a quiet day it sends nothing.

## What is inside

- `workflow.json`: the workflow as n8n exports it, fourteen nodes that all run and no sticky notes. It holds no credential.
- `README.md`: these notes.

## What we changed from the original copy

- The made-up values `YOUR_EMAIL@example.com`, `YOUR_APP_PASSWORD`, `YOUR_IMAP_HOST`, `YOUR_NTFY_TOPIC`, `YOUR_TELEGRAM_CHAT_ID` and
  `YOUR_OLLAMA_MODEL` are now placeholders in angle brackets, such as `<YOUR_APP_PASSWORD>`.
- The example mail in the prompt came from a real service address. It is now `Example Accounts <no-reply@example.com>`.
- The credential link on the Telegram node was removed. Select your own.
- Nothing else. The script, the pattern lists, the prompts, the model settings and the layout of the message are as they were.

## Before you start

- A self-hosted n8n with the Execute Command node turned on. n8n Cloud does not have it, and n8n 2.0 switches it off by default, so
  remove it from `NODES_EXCLUDE`.
- Python 3 and a POSIX shell on the machine that runs n8n. In Docker, the command runs inside the n8n container.
- An IMAP mailbox with its host, user and an app password. For Gmail, Google's help says an app password needs 2-Step Verification.
- Ollama on the same machine, listening on `http://127.0.0.1:11434`, with a chat model pulled.
- A Telegram bot token and your chat id.
- A hard-to-guess ntfy topic name, for the fallback.

## Set it up

1. In n8n, create a workflow, open its menu and choose Import from File. Pick `workflow.json`.
2. Open `Fetch Gmail via IMAP`. At the top of the command, replace `<YOUR_EMAIL_ADDRESS>`, `<YOUR_APP_PASSWORD>` and
   `<YOUR_IMAP_HOST>` with your own values. Keep the quotes.
3. Open `Call Ollama Summary API` and replace `<YOUR_OLLAMA_MODEL>` with the name of a model you have pulled. `ollama list` shows them.
4. Add a Telegram credential with your bot's token and select it in `Send Telegram Summary`. Replace `<YOUR_TELEGRAM_CHAT_ID>` in
   that node with your chat id.
5. In `Send ntfy Summary`, replace `<YOUR_NTFY_TOPIC>` in the address with your topic, and subscribe to the topic in the ntfy app.
6. Click Test workflow. `Manual Trigger` starts the run. It sends a message only when the model finds an urgent thread.
7. Check the workflow's timezone in its settings, since the schedule runs at 23:59 in it. Then save and press Publish at the top of
   the canvas (or Shift+P).

## How a run goes

1. `Manual Trigger` or `Schedule Trigger` starts the run. The schedule fires every day at 23:59.
2. `Fetch Gmail via IMAP` runs a Python script. It logs in over SSL on port 993, opens the inbox and searches for mail since
   yesterday's date. It fetches each message with `BODY.PEEK[]`, so nothing is marked as read, and keeps the ones from the last 24 hours.
3. The same script cuts each body to 2000 characters, groups the messages into threads and keeps up to 6 messages and 6000
   characters of text per thread. It prints one JSON object.
4. `Parse JSON Output` turns that output into an item. An empty output becomes an item with a note.
5. `Build Summary Prompt` mutes threads that match a list of patterns for promotions, job alerts, newsletters and similar. It
   marks urgent ones by another list. It prepares a fallback result of up to 5 urgent threads and 3 for info, and a context of
   up to 12 threads and 24000 characters.
6. `Prepare Structured Prompt` writes the system and user prompts. They ask for one JSON object with a summary, up to 5 urgent
   items and up to 3 items for info.
7. `Call Ollama Summary API` posts the prompts to `/api/chat` on your Ollama with temperature 0, a 32768-token context and at
   most 260 tokens of answer. It waits up to 90 seconds, and an error does not stop the run.
8. `Parse Ollama Summary` reads the JSON from the reply and trims each field. When the reply is not valid JSON, it uses the fallback result.
9. `Has Urgent Items?` lets the run go on only when at least one urgent item is left.
10. `Normalize Summary Message` writes the report: a summary, a text table of the urgent threads, up to 3 lines for info and a
    count of muted threads. It also makes an HTML version with the table in a `pre` block.
11. `Fix Action Table Layout` passes the item on unchanged.
12. `Send Telegram Summary` sends the HTML version. When it fails, `Telegram Delivery Failed?` sends the run to `Send ntfy Summary`,
    which posts the plain text with a title, a high priority and the tag `mail`.

## Change the look

- The window: the cutoff and the search date in the script inside `Fetch Gmail via IMAP`.
- What counts as muted, urgent or for info: the pattern lists in `Build Summary Prompt`.
- The prompt and the answer limits: `Prepare Structured Prompt`.
- The model and its settings: the request body in `Call Ollama Summary API`.
- The look of the message: `Normalize Summary Message`. The table columns are 26, 18 and 30 characters wide.
- The time: `Schedule Trigger`.

## Good to know

- Not run: Mindket made no call to an IMAP server, Ollama, Telegram or ntfy. It checked the Python script's syntax and ran the
  Code steps on its own machine with a sample thread and a sample model reply.
- The mail password sits in the command text. Anyone who can open the workflow can read it, so use an app password and keep the
  workflow to yourself.
- ntfy has no sign-up. Its documentation says the topic works like a password. The fallback text lists the subjects and
  senders of your urgent mail, so pick a topic nobody can guess.
- The mute patterns match word parts anywhere in the subject, the sender and the body, with no word borders. A real mail that
  contains "deal", "offer" or "sale" is muted before the model sees it. Edit the lists if that hurts.
- On a day with no urgent thread nothing is sent, not even a note that the day was quiet.
- The request sets `think` to false and asks for JSON output. Ollama's documentation describes `think` for thinking models.
- A 32768-token context needs more memory than Ollama's default, which its documentation puts at 4k on a machine with under 24 GiB
  of VRAM. The 260-token limit can cut a long answer short, and the workflow then falls back to its own lists.
- The message bodies go only to your own Ollama. The urgent subjects and senders go to Telegram, and to ntfy.sh if Telegram fails.
- A message can carry text meant to steer the model, so a mail can be listed as urgent or left out. Treat the report as a prompt to
  look, not a full check.
```

## What is in it

3 files, 50 KB, downloaded as a zip.

```text
NOTICE.md  608 B
README.md  7 KB
workflow.json  42 KB
```

## Workflow check

Checked by Mindket on 13 Nov 2026. Read from the workflow’s file, not from a run.

- Steps: 14 steps, starting by hand or on a schedule
- AI: No step calls an AI model
- Sign-ins: Signs in to: Telegram
- API keys: No API key is left in the file
- Step types: Mindket’s checker reads 6 of its 7 step types. It does not read: Execute Command

## Get it

- [Get it on your Mindket account](https://account.mindket.com/account/?product=mindket#/market/855412bf-513b-4aa1-8685-39e91344adf2)
- [Its page on Mindket](https://mindket.com/p/855412bf-513b-4aa1-8685-39e91344adf2)
