# Mail Triage (`enezli/mail-triage`) Actor

Email triage with AI. Classifies hundreds of emails, surfaces the few that genuinely need a reply, and drafts responses for simple ones. Never sends, so a human stays in control. Reclaim hours from your inbox.

- **URL**: https://apify.com/enezli/mail-triage.md
- **Developed by:** [Turgay NANTA](https://apify.com/enezli) (community)
- **Categories:** AI, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 email triageds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Email Triage → Daily Digest

Classifies hundreds of emails with AI, **surfaces the few that genuinely need a reply**, suggests a draft for simple emails (never sends), and produces a **company/person-grouped visual report**.

> **No subscription — you pay per email processed.** Obvious mail like ads and newsletters is filtered out automatically, for free.

---

### What it does

Your inbox has hundreds of emails, but most are ads, notifications and newsletters — only a handful actually need a reply from you. This actor finds that handful:

- 🗂️ **Classifies:** Business-Critical · Personal · Social · Promotional · Informational · General
- 🎯 **Prioritizes:** surfaces the ones that genuinely need a reply, deprioritizes the rest
- 🏢 **Groups by company + person** (not the email address): "Ulus Metal → Ahmet Yılmaz"
- 👤 **Addressed to you:** specially flags real emails that address you by name
- 🔔 **Reply vs. Action:** a no-reply (automated) email can't be replied to → it won't mislead you with "reply"
- ✍️ **Suggests a draft** (only for simple emails like greetings) — **never auto-sends**
- 📊 **Daily visual report:** total, awaiting reply, action required, category distribution

### Safety & privacy

- **No sending:** it only classifies and suggests drafts; it never emails anyone on your behalf.
- **A business-critical email is never silently filtered out** (it's surfaced even if it contains an ad keyword).
- **No fabrication:** anything uncertain is clearly flagged "Low confidence".

### Input

| Field | Description |
|---|---|
| `emails` | The emails to triage: `{from, subject, body}` (+ optional `date`, `to`, `cc`, `list_unsubscribe`). Can be connected from an email export (.eml/.mbox → JSON). |
| `kullanici_isimleri` | Your name/surname parts (e.g. `["Turgay"]`) → emails addressing you by name are surfaced. Optional. |
| `kullanici_eposta` | Your email address → if you're only CC'd, the email is deprioritized as informational. Optional. |
| `language` | Output / draft language: English / Türkçe / Deutsch / Español / Français |
| `model` | (Advanced) LLM model — the default is fast and economical |
| `process` | Off = free preview only; On = process (incurs charges) |

### Output

Delivered in layers:

- **Dataset (table):** prioritized triage rows — columns: `Company` · `Person` · `Subject` · `Category` · `Priority` · `Reply?` · `Addressed` · `Draft` · `Confidence` · `Note`. Scan, sort and export directly.
- **Daily report (key-value store → `DAILY_REPORT`):** English keys: `total_emails` · `category_distribution` · `needs_reply` · `drafts_prepared` · `deterministic_filtered_no_llm` · `llm_processed` · `low_confidence` · `focus`.
- **Drafts (`DRAFTS`):** suggested replies for simple emails — you copy and send (the actor never sends).
- **Visual report (`TRIAGE_REPORT.html`):** a downloadable company/person-grouped report with summary cards.

### How to use

1. Provide your emails as `emails` (`{from, subject, body}`) — or connect an email export.
2. (Optional) Enter your name → emails addressed to you are surfaced.
3. Turn on `process` and **Start** → prioritized triage table + visual report.

### Who is it for?

Anyone with a busy inbox: managers · sales/support teams · SMB owners · freelancers.

### Example

| Company | Person | Subject | Category | Status |
|---|---|---|---|---|
| Ulus Metal | Ahmet Yılmaz | Quote revision | Business-Critical | ⚠️ Awaiting Reply 👤 |
| Bank | (generic) | Account verification | General | 🔔 Action Required |
| Store | (generic) | 50% discount | Promotional | — |

### Pricing (Pay-Per-Event)

You only pay for what you use: per run + per email processed by the LLM. Deterministically filtered emails (ads, newsletters) are free. No monthly subscription.

# Actor input Schema

## `emails` (type: `array`):

The emails to triage. Each item: {from, subject, body} plus optional {date, to, cc, list_unsubscribe}. to/cc → CC distinction; list_unsubscribe → filters bulk mail for free; date → thread order. Can be connected from an email export (.eml/.mbox → JSON) (BYOD).
## `kullanici_isimleri` (type: `array`):

Emails that mention your name/surname are flagged as 'addressed to you' and surfaced. e.g. ['Turgay', 'Nanta']. Leave empty to disable this feature.
## `kullanici_eposta` (type: `string`):

By looking at the To/Cc headers: if you are only CC'd (not the direct addressee) the email is treated as 'informational' and deprioritized. Leave empty to disable CC distinction.
## `language` (type: `string`):

The language of the classification text and draft replies.
## `model` (type: `string`):

Classification model. The default is cheap and fast; pick a stronger model for more consistent results.
## `process` (type: `boolean`):

When off, only a FREE preview (email count + how many can be filtered without the LLM). When on, it processes — charged per email processed by the LLM (deterministically filtered ones are free).

## Actor input object example

```json
{
  "emails": [
    {
      "from": "ceo@acme-corp.com",
      "subject": "Contract renewal — urgent decision needed",
      "body": "Hi, we need your approval on the renewal terms by Friday. Can we hop on a call tomorrow? This is blocking the legal team."
    },
    {
      "from": "deals@shopnow.com",
      "subject": "48-hour FLASH SALE — 50% off everything!",
      "body": "Limited time offer just for you. Click to unsubscribe."
    },
    {
      "from": "sarah@gmail.com",
      "subject": "Lunch next week?",
      "body": "Hey! Are you free for lunch on Tuesday? Would love to catch up."
    }
  ],
  "kullanici_isimleri": [],
  "kullanici_eposta": "",
  "language": "English",
  "model": "claude-haiku-4-5-20251001",
  "process": false
}
````

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "emails": [
        {
            "from": "ceo@acme-corp.com",
            "subject": "Contract renewal — urgent decision needed",
            "body": "Hi, we need your approval on the renewal terms by Friday. Can we hop on a call tomorrow? This is blocking the legal team."
        },
        {
            "from": "deals@shopnow.com",
            "subject": "48-hour FLASH SALE — 50% off everything!",
            "body": "Limited time offer just for you. Click to unsubscribe."
        },
        {
            "from": "sarah@gmail.com",
            "subject": "Lunch next week?",
            "body": "Hey! Are you free for lunch on Tuesday? Would love to catch up."
        }
    ],
    "kullanici_isimleri": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("enezli/mail-triage").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "emails": [
        {
            "from": "ceo@acme-corp.com",
            "subject": "Contract renewal — urgent decision needed",
            "body": "Hi, we need your approval on the renewal terms by Friday. Can we hop on a call tomorrow? This is blocking the legal team.",
        },
        {
            "from": "deals@shopnow.com",
            "subject": "48-hour FLASH SALE — 50% off everything!",
            "body": "Limited time offer just for you. Click to unsubscribe.",
        },
        {
            "from": "sarah@gmail.com",
            "subject": "Lunch next week?",
            "body": "Hey! Are you free for lunch on Tuesday? Would love to catch up.",
        },
    ],
    "kullanici_isimleri": [],
}

# Run the Actor and wait for it to finish
run = client.actor("enezli/mail-triage").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "emails": [
    {
      "from": "ceo@acme-corp.com",
      "subject": "Contract renewal — urgent decision needed",
      "body": "Hi, we need your approval on the renewal terms by Friday. Can we hop on a call tomorrow? This is blocking the legal team."
    },
    {
      "from": "deals@shopnow.com",
      "subject": "48-hour FLASH SALE — 50% off everything!",
      "body": "Limited time offer just for you. Click to unsubscribe."
    },
    {
      "from": "sarah@gmail.com",
      "subject": "Lunch next week?",
      "body": "Hey! Are you free for lunch on Tuesday? Would love to catch up."
    }
  ],
  "kullanici_isimleri": []
}' |
apify call enezli/mail-triage --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=enezli/mail-triage",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Mail Triage",
        "description": "Email triage with AI. Classifies hundreds of emails, surfaces the few that genuinely need a reply, and drafts responses for simple ones. Never sends, so a human stays in control. Reclaim hours from your inbox.",
        "version": "0.1",
        "x-build-id": "VxiJhQZodPzxdGa4i"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/enezli~mail-triage/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-enezli-mail-triage",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/enezli~mail-triage/runs": {
            "post": {
                "operationId": "runs-sync-enezli-mail-triage",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/enezli~mail-triage/run-sync": {
            "post": {
                "operationId": "run-sync-enezli-mail-triage",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "emails": {
                        "title": "Emails",
                        "type": "array",
                        "description": "The emails to triage. Each item: {from, subject, body} plus optional {date, to, cc, list_unsubscribe}. to/cc → CC distinction; list_unsubscribe → filters bulk mail for free; date → thread order. Can be connected from an email export (.eml/.mbox → JSON) (BYOD)."
                    },
                    "kullanici_isimleri": {
                        "title": "Your name / surname (for 'addressed to you' detection)",
                        "type": "array",
                        "description": "Emails that mention your name/surname are flagged as 'addressed to you' and surfaced. e.g. ['Turgay', 'Nanta']. Leave empty to disable this feature.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "kullanici_eposta": {
                        "title": "Your email address (for CC distinction)",
                        "type": "string",
                        "description": "By looking at the To/Cc headers: if you are only CC'd (not the direct addressee) the email is treated as 'informational' and deprioritized. Leave empty to disable CC distinction.",
                        "default": ""
                    },
                    "language": {
                        "title": "Output / draft language",
                        "enum": [
                            "Türkçe",
                            "English",
                            "Deutsch",
                            "Español",
                            "Français"
                        ],
                        "type": "string",
                        "description": "The language of the classification text and draft replies.",
                        "default": "English"
                    },
                    "model": {
                        "title": "Model (advanced)",
                        "enum": [
                            "claude-haiku-4-5-20251001",
                            "claude-sonnet-4-6"
                        ],
                        "type": "string",
                        "description": "Classification model. The default is cheap and fast; pick a stronger model for more consistent results.",
                        "default": "claude-haiku-4-5-20251001"
                    },
                    "process": {
                        "title": "Process (incurs charges)",
                        "type": "boolean",
                        "description": "When off, only a FREE preview (email count + how many can be filtered without the LLM). When on, it processes — charged per email processed by the LLM (deterministically filtered ones are free).",
                        "default": false
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
