# Delivery status (/docs/email/delivery)

## Email status [#email-status]

`status` on the email says whether it was handed to the delivery provider:

| Status   | Meaning                                       |
| -------- | --------------------------------------------- |
| `scheduled` | Waiting for `scheduled_at` |
| `canceled` | Canceled before dispatch |
| `queued` | Accepted by coss.com, not yet handed over          |
| `sent`   | Accepted by the provider (`sent_at` is set)    |
| `failed` | Could not be sent; `failure` says why |

A failed email's `failure` is `{ code, message }`, e.g. `all_recipients_suppressed`,
`domain_not_verified`, `content_rejected`, `attachments_unavailable`, `dispatch_failed` or
`provider_error`; it is `null` for every other status.

## Recipient status [#recipient-status]

Delivery happens per recipient. `recipients` lists every distinct address across `to`, `cc` and
`bcc`, each with its own `status`. A status only moves forward:

`queued` → `sent` → `delivery_delayed` → `delivered`, then `bounced` / `suppressed` / `failed`, then
`complained`.

`suppressed` means the recipient was skipped because it is on the environment's
[suppression list](/docs/email/suppressions), or the provider reported it as suppressed. An email
whose recipients are all suppressed fails with `all_recipients_suppressed`.

coss.com automatically [screens](/docs/content-screening) a sample of live emails for spam, phishing
and other abuse right before sending them. An email it is confident about fails with `content_rejected` and live sending is
suspended until coss.com support reviews the account. Sandbox emails are never screened.
coss.com also emails your organization's owners and admins when it warns about your sending
[reputation](/docs/reputation) or suspends live sending.

## Finding emails [#finding-emails]

List an environment's emails, newest first, with `coss.email.list` (see
[`GET /v1/emails`](/docs/api-reference/emails/list-emails)). Filter by a recipient's address, by the
email's status or a recipient's, by subject text, category, batch or creation time. Listed emails
have no content; retrieve one for `html`, `text`, `headers` and `attachments`.

```ts twoslash
import { Coss } from "coss";
const coss = new Coss();
// ---cut---
const { data } = await coss.email.list({
  to: "user@example.com",
  recipient_status: ["bounced", "complained"],
  created_after: new Date(Date.now() - 24 * 60 * 60 * 1000),
});

for (const email of data?.data ?? []) {
  console.log(email.id, email.subject, email.failure?.code);
  //                                         ^?
}
```

Coding agents can answer these questions for you with the [MCP server](/docs/mcp).

## Events [#events]

Each change is recorded as an event. List them with
`coss.email.listEvents` (see
[`GET /v1/emails/{id}/events`](/docs/api-reference/emails/list-email-events)), or receive them as [webhooks](/docs/webhooks).

```ts twoslash
import { Coss } from "coss";
const coss = new Coss();
// ---cut---
const { data: events } = await coss.email.listEvents("email_01k7c8m4q2f3e9v6t5r1n0p8yz");

for (const event of events?.data ?? []) {
  if (event.type === "email.bounced") {
    console.log(event.recipient, event.data.bounce?.type);
    //                                          ^?
  }
}
```

`email.sent`, `email.failed`, `email.scheduled`, `email.rescheduled` and `email.canceled` describe the whole email
(`recipient` is `null`). Delivery events describe individual recipients. Open and click events
name a recipient only when the email had exactly one non-suppressed recipient.
`email.unsubscribed` names the recipient who used [one-click unsubscribe](/docs/email/unsubscribe).
