# Search

> How search works in Postern, what it covers, every operator with examples, and where the search runs.

Source: https://docs.posternmail.app/using/search/

This page explains what a search covers, every operator you can type, and where the search
runs. Postern uses one query language for search, for custom split-inbox sections and for rule
queries, so everything here applies there too.

![A search limited to one mailbox, with "Search all mail instead"](https://posternmail.app/img/search.webp)

## Start a search

Click the search box at the top of the list, or press `/`. Type, then press `Enter`.

While you type, Postern suggests contacts, folders, tags and operators. Use the arrow keys to
highlight one and `Tab` to complete it; `Enter` searches for exactly what you typed unless you
highlighted a suggestion. With an empty box, the list shows your last six **Recent searches**
(kept in this browser only). The command palette (`⌘K` / `Ctrl+K`) also offers **Search mail
for "…"**.

Results are conversations, newest first. The words you searched for are highlighted in the
sender, subject and preview. The list loads 50 at a time; the count says **50+ results** while
more can be loaded.

## What a search covers

| Where you search from | What is searched |
|---|---|
| Inbox, All mail, or a search | All mail (everything except Trash and Spam). |
| Sent, Archive, Trash, Spam, Drafts, Starred, Snoozed | Only that view: Postern puts `in:sent`, `in:archive`, `in:trash`, `in:spam`, `in:drafts`, `is:starred` or `is:snoozed` in front of your words. |
| A folder | Only that folder (`in:` with the folder). |
| A tag | Only that tag (`tag:`). |
| A mailbox's Inbox or a band of **Unread by mailbox** | Only that mailbox. |
| Any of these inside a Space | Only the Space's mailboxes. |

The search box says what it will search: **Search Sent**, **Search Work** (a Space), or
**Search all mail**. The added operator is visible in the query, so you can remove it. If your
query already names a place (`in:`, `is:`, `tag:`, `mailbox:` or `space:`), nothing is added.

When a search is limited to one place, the results show **Search all mail instead**. It runs the
same words without the place (and without the mailbox filter). Inside a Space it still covers
only that Space; switch to **All mailboxes** in the sidebar to search everything.

Trash and Spam are left out unless the query asks for them with `in:trash` or `in:spam`.

## Words and phrases

| You type | Matches |
|---|---|
| `invoice` | Messages with a word starting with "invoice" (invoice, invoices, invoiced) in the subject, the sender's name or address, the recipients, the text or an attachment name. |
| `invoice march` | Messages containing both words, anywhere. |
| `"march invoice"` | The exact phrase. Inside quotes, `\"` is a quote and `\\` a backslash. |

Words match from their start: `voice` does not find "invoice". Case and accents do not matter
(`cafe` finds "Café"). Punctuation separates words.

## Combining terms

| Syntax | Meaning | Example |
|---|---|---|
| space or `AND` | Both must match. | `from:anna invoice` |
| `OR` or `\|` | Either may match. Write `OR` in capitals. | `from:anna OR from:ben` |
| `-` or `NOT` | Must not match. | `invoice -paid`, `NOT is:read` |
| `( )` | Grouping. | `(from:anna OR from:ben) has:attachment` |
| `{ }` | Any of these (a short form of OR). | `{from:anna from:ben}` |
| `operator:( )` | Applies the operator to every word inside. | `subject:(budget draft)` = `subject:budget subject:draft` |

`OR` binds tighter than the space: `a b OR c` means `a AND (b OR c)`, as in Gmail. Search is
forgiving: a missing closing bracket or quote is closed for you, and a stray `OR` at the end is
ignored. An unknown `word:value` (for example `foo:bar`) is searched as plain text.

## Operators

Operator names are not case-sensitive. A value with spaces goes in quotes: `subject:"quarterly
report"`.

### People and text

| Operator | Matches | Examples |
|---|---|---|
| `from:` | Sender name or address contains the value. A value starting with `@` matches the end of the address (a domain). | `from:anna`, `from:anna@example.com`, `from:@example.com` |
| `to:` | Any recipient (To, Cc or Bcc) contains the value; `@domain` matches recipients at that domain. | `to:ben`, `to:@example.com` |
| `cc:` | A Cc recipient. | `cc:carla@example.com` |
| `bcc:` | A Bcc recipient (only visible on mail you sent). | `bcc:me@example.com` |
| `subject:` | The subject contains the value (anywhere in a word). | `subject:invoice`, `subject:"Q3 report"` |
| `filename:` | An attachment name contains the value. | `filename:pdf`, `filename:contract` |
| `list:` | The mailing-list ID (`List-Id` header) contains the value; angle brackets are ignored. | `list:news.example.com` |

### State

| Operator | Values (aliases in brackets) |
|---|---|
| `is:` | `unread`, `read`, `starred` (`flagged`), `pinned`, `muted`, `vip`, `snoozed`, `answered` (`replied`), `draft` |
| `has:` | `attachment` (`attachments`), `invite` (`invites`, a calendar invitation), `link` (`links`) |
| `category:` | `people` (`person`, `primary`), `notifications` (`notification`), `newsletters` (`newsletter`): the [split inbox](https://docs.posternmail.app/using/inbox/#split-inbox) section |

Examples: `is:unread has:attachment`, `is:vip -is:read`, `category:newsletters older_than:1m`.

An unknown value is an error, for example **Unknown value "big" for is: (try unread, read,
starred, pinned, muted, vip or snoozed)**.

### Places

| Operator | Values | Examples |
|---|---|---|
| `in:` | `inbox`, `sent`, `archive` (`archived`), `trash` (`bin`), `spam` (`junk`), `drafts` (`draft`), `all` (everything except Trash and Spam), or a folder by name or path | `in:sent`, `in:"Clients/Acme"`, `in:Receipts` |
| `mailbox:` | A mailbox by its address | `mailbox:you@example.com` |
| `space:` | A Space by name (not case-sensitive) | `space:Work` |
| `tag:` (also `label:`) | A tag by name | `tag:Clients`, `label:"To do"` |

A folder name that matches folders in several mailboxes finds all of them. A name that matches
nothing finds nothing.

### Dates

| Operator | Matches | Examples |
|---|---|---|
| `after:` (also `newer:`) | Received on or after that day, from midnight. | `after:2026-01-01` |
| `before:` (also `older:`) | Received before that day (the day itself is not included). | `before:2026-02-01` |
| `newer_than:` | Received within the last period. | `newer_than:7d` |
| `older_than:` | Received longer ago than the period. | `older_than:1y` |

Dates are written `2026-01-31`, `2026/01/31`, `2026-1-31`, `2026/1/31` or `2026.01.31`. A full
timestamp such as `2026-01-31T09:00:00Z` and Unix seconds also work. Days start at midnight in
the Hub's time zone (the device's, in the desktop and phone apps).

Periods are a number with a unit: `h` hours, `d` days, `w` weeks, `m` months, `y` years. A bare
number means days (`newer_than:3` = 3 days).

A month of January: `after:2026-01-01 before:2026-02-01`.

Errors: **Invalid date "31.01." for after: (use YYYY-MM-DD)**, **Invalid age "soon" for
newer_than: (use e.g. 7d, 2w, 3m or 1y)**.

### Size

| Operator | Matches | Examples |
|---|---|---|
| `larger:` | Messages bigger than the size. | `larger:5M`, `larger:500K` |
| `smaller:` | Messages smaller than the size. | `smaller:100K` |

Sizes are a number (decimals allowed) with an optional `K`, `M` or `G`, counted in steps of
1024; `KB`, `MB`, `MiB` are accepted too. A plain number is bytes. Example: `larger:1.5M`.
Error: **Invalid size "huge" for larger: (use e.g. 500K or 5M)**.

## Examples

| Query | Finds |
|---|---|
| `from:@example.com has:attachment newer_than:30d` | Attachments from anyone at example.com in the last 30 days. |
| `in:sent to:anna` | Mail you sent to Anna. |
| `from:anna -is:answered` | Mail from Anna you have not replied to (the provider's answered flag). |
| `subject:(invoice OR receipt) after:2026-01-01 -in:archive` | Invoices or receipts this year that are not archived. |
| `larger:10M older_than:1y` | Big old mail, for cleaning up. |
| `is:unread category:people space:Work` | Unread personal mail in the Work Space. |
| `"order confirmation" in:trash` | A phrase in Trash. |

## Where the search runs

Postern never sends your search to the mail provider. It searches the copy of your mail that the
app is connected to:

| App | Searches |
|---|---|
| Web app | The Hub's copy of your mail. |
| Desktop and phone apps | The app's own copy on the device. This also works when the Hub is unreachable. |

The full text index holds the subject, sender, recipients, attachment names and the first 256 KB
of each message's text. Until a message's body has been downloaded, only its first line is
indexed. The Hub downloads bodies ahead of time for the last 30 days
(`POSTERN_BODY_CACHE_DAYS`, see [Configuration](https://docs.posternmail.app/configuration/)); older bodies are
downloaded when you open the message, and become searchable then. Searches on sender, subject,
dates, size and the other operators cover every message that has synced.

> [!NOTE]
> The Hub keeps a full copy of your mail only while you use the web app (and for 7 days after),
> unless you turn on **Settings → Reading & sending → Keep a full copy of my mail on my Hub**.
> When you come back to the web app after a long break, the Hub catches up first, and search
> results fill in as it does.

## Limits

- No fuzzy matching and no word endings in the middle of words: `voice` does not find "invoice"
  (except with `subject:`, `from:`, `to:` and `filename:`, which match anywhere).
- Only the first 256 KB of a message's text is searched.
- Mail that has not synced yet (a mailbox still downloading) is not found.
- Searches are not saved on your Hub; recent searches stay in the browser or app.
