
# Reading mail

All reads go to your mail server live, and none of them mark messages as read.

## List a folder

```bash
fob-email emails list                         # newest 50 in INBOX
fob-email emails list --unseen --limit 20     # newest 20 unread
fob-email emails list --folder Archive
fob-email emails list --fields id,from,subject,date,attach
```

```text
ID    FROM                    SUBJECT                           DATE
-----------------------------------------------------------------------------------
1423  billing@vendor.example  Invoice INV-2291 for September    2026-10-01 14:42:44
1419  noreply@bank.example    Your statement is ready           2026-09-30 11:32:10
1417  ap@northwind.example    Remittance advice: payment 88213  2026-09-29 20:10:00
```

- Messages come **newest first**, with dates in your computer's time zone. `--limit` sets how many (default 50). There's no paging: to see older messages, raise `--limit` or use `search` with `--since`.
- `--fields` picks columns from `id`, `from`, `to`, `subject`, `date`, `flags` and `attach`. `to` shows the first recipient, and `attach` shows `*` when a message has attachments. Empty cells show `—`.
- When the list fills `--limit`, a note `(showing 50; raise --limit for more)` prints on stderr.

## Message IDs

The `ID` column is the message's number **within that folder** (its IMAP UID). Keep two rules in mind:

- Pass the same `--folder` when you use the ID: `fob-email emails show 1423 --folder Archive`. The default folder is `INBOX`.
- A message gets a new ID when it moves to another folder.

## Search

```bash
fob-email emails search "invoice"                          # in headers and body
fob-email emails search --from billing@vendor.example
fob-email emails search --subject statement --since 2026-09-01
fob-email emails search "overdue" --folder Archive --limit 100
```

The query matches anywhere in the message. `--from`, `--subject` and `--since` (a `YYYY-MM-DD` date, inclusive) narrow it further, and all conditions must match. Matching is done by your mail server: it finds words and addresses, not meaning.

## Open a message

```bash
fob-email emails show 1423
```

```text
--- Email #1423 ---
From:     Vendor Billing <billing@vendor.example>
To:       you@example.com
Subject:  Invoice INV-2291 for September
Date:     2026-10-01T09:12:44.000Z
Msg-Id:   <inv-2291@vendor.example>

Hi, please find attached your invoice for September.

--- Attachments ---
  INV-2291.pdf  (application/pdf, 84.2 KB)
```

`show` prints the plain-text body, and the date in UTC. With `--json` you also get the HTML body and attachment details. See [Output and scripting](/docs/email/cli/output-and-scripting).

## Download attachments

```bash
fob-email emails download 1423 -o ./invoices
```

Every attachment is saved into the `-o` folder (default: the current folder), which is created if needed. A file with the same name is overwritten. Each saved file prints `Wrote <path>` on stderr, and `--json` prints the list of saved files on stdout.

## Conversations

```bash
fob-email threads list --limit 20
fob-email threads show 1423
```

```text
LATEST  MSGS  SUBJECT               DATE
-------------------------------------------------------
1423       3  Re: Invoice INV-2291  2026-10-01 14:42:44
1402       1  Contract renewal      2026-09-27 15:30:00
```

- `threads list` groups the folder's recent messages into conversations, most recent activity first. `LATEST` is the ID of the newest message in each.
- `threads show <id>` takes **any message ID** in the conversation and prints the whole conversation, oldest first.
- Gmail and servers that provide conversation IDs group exactly. On other servers fob-email follows reply headers, looking back over the folder's most recent 500 messages.
- A conversation is read from one folder (default `INBOX`). Only messages in that folder are included, so your own replies, which sit in your Sent folder, usually don't appear.

## Folders

```bash
fob-email folders list
```

```text
PATH               SPECIAL  SUBSCRIBED
--------------------------------------
INBOX              —        yes
[Gmail]/Drafts     \Drafts  yes
[Gmail]/Sent Mail  \Sent    yes
Invoices/2026      —        yes
```

`PATH` is the name to use with `--folder`. `SPECIAL` marks your provider's Drafts, Sent, Trash, Junk and All Mail folders. Folder names with spaces or brackets need quotes, for example `--folder "[Gmail]/Sent Mail"`.
