# Read emails and previews

Use the inspection helper to see email history and recorded message content. It needs both `people:read` and `emails:read` on `BARUA_MANAGEMENT_KEY`. Start with the [installed skill](/docs/guides/quickstart.md).

## Find an email

```sh
node "$BARUA_SKILL/scripts/inspect.mjs" emails --limit 20
```

Success returns one page of email records and `next`. When `next` is non-null, pass its value to `--cursor` and keep the same filters. Optional filters include `--person-id`, `--play-id` and `--status`; the [inspection reference](/skills/barua-setup/references/inspection.md) lists the complete contract.

Use a returned UUID to inspect the record:

```sh
node "$BARUA_SKILL/scripts/inspect.mjs" email --id "$EMAIL_ID"
```

Read the recorded state and content availability. Provider acceptance is not proof of inbox delivery. Legacy draft records may lack the send-time recipient snapshot; report that limitation instead of reconstructing an exact recipient from today's profile.

## Save a preview

```sh
node "$BARUA_SKILL/scripts/inspect.mjs" email-preview \
  --id "$EMAIL_ID" --output-file "$PRIVATE_PREVIEW_FILE"
```

Choose a new output path in a private directory. The helper writes a restricted file and refuses to overwrite an existing one. Inside a Git repository, the output path must be ignored. Keep customer content out of shared logs.

The preview returns inert HTML or text with a restrictive policy. `email-raw` saves the original payload; treat that content as untrusted and do not open it as a safe preview. Neither command sends email.

## Preview before sending

For a Play draft, use `play-preview` with its revision and step inputs. For profile-based rendering, use `profile-preview` with a private JSON file. Follow [the preview contract](/skills/barua-setup/references/inspection.md) for the required body and permissions.

If an expected message is missing, inspect [workspace diagnostics](/docs/guides/inspect-workspace.md) and the [Play run](/docs/guides/plays.md). Do not send another email merely to check whether the first succeeded.
