> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langmail.me/llms.txt
> Use this file to discover all available pages before exploring further.

# Search and triage email

> End-to-end email tasks through an agent — find to-dos, filter by category and sender, read full messages and threads.

Langmail classifies every incoming message into a category and flags the ones that need action. Your agent can use those labels as structured search filters instead of paging through an inbox. This guide shows common tasks as the prompt you give, the tool call the agent makes, and what comes back.

The three email tools divide the work:

* [`search_emails`](/reference/mcp/search-emails) finds messages — compact hit lists, no bodies.
* [`get_email`](/reference/mcp/get-email) reads one message in full.
* [`get_thread`](/reference/mcp/get-thread) lists every message in a conversation.

## Find what needs action

```text Prompt theme={null}
What's on my email to-do list from the last week?
```

The agent combines the `todo` category with a date filter:

```json Tool call — search_emails theme={null}
{
  "keywords": ["todo"],
  "after": "2026-06-30T00:00:00Z"
}
```

```text Result theme={null}
2 message(s) matched:

1. Please confirm your new contract
   id: Mf31a
   from: HR <hr@acme.example>
   date: 2026-07-03T09:20:00Z
   tags: direct, todo

2. Your domain renewal expires soon
   id: Mf2c8
   from: Registrar <noreply@registrar.example>
   date: 2026-07-01T12:05:00Z
   tags: notification, todo
```

## Filter by category

The `keywords` filter takes any of the classification values — `direct`, `receipt`, `newsletter`, `notification`, `promotional`, plus the orthogonal `todo` flag — combined with OR:

```text Prompt theme={null}
Collect all receipts from June for my expense report.
```

```json Tool call — search_emails theme={null}
{
  "keywords": ["receipt"],
  "after": "2026-06-01T00:00:00Z",
  "before": "2026-07-01T00:00:00Z",
  "limit": 100
}
```

What the categories mean and how they get applied is covered in [Email intelligence](/concepts/email-intelligence).

## Search by sender and text

`from` matches a substring of the sender's name or address; `query` is full-text over subject and body. They compose:

```text Prompt theme={null}
Find the message from Jonas about the offsite budget.
```

```json Tool call — search_emails theme={null}
{
  "from": "jonas",
  "query": "offsite budget"
}
```

## Read the full message

Search results are deliberately body-free to stay light on tokens. The agent opens a specific hit by id:

```json Tool call — get_email theme={null}
{ "id": "Mf31a" }
```

```text Result theme={null}
Subject: Please confirm your new contract
From: HR <hr@acme.example>
To: you@langmail.me
Date: 2026-07-03T09:20:00Z
Tags: direct, todo

Hi,

please review the attached contract draft and confirm by Friday.
...
```

## Follow a conversation

Given any message id, `get_thread` returns the whole conversation oldest-first, so the agent can reconstruct context before answering:

```json Tool call — get_thread theme={null}
{ "id": "Mf31a" }
```

```text Result theme={null}
3 message(s) in thread:

1. Contract renewal timeline
   id: Mf2f0
   from: HR <hr@acme.example>
   date: 2026-06-28T10:00:00Z
   tags: direct

2. Re: Contract renewal timeline
   id: Mf2f4
   from: You <you@langmail.me>
   date: 2026-06-28T14:12:00Z

3. Please confirm your new contract  ← requested
   id: Mf31a
   from: HR <hr@acme.example>
   date: 2026-07-03T09:20:00Z
   tags: direct, todo
```

<Note>
  The email surface is read-only: agents can search and read but not send, draft, or delete mail. If a to-do needs a reply, the agent drafts the text and you send it from webmail or your mail client.
</Note>
