# `SquatchMail.Email`
[🔗](https://github.com/Axio-Intelligence/Squatch-Mail/blob/v0.1.0/lib/squatch_mail/email.ex#L1)

A captured or sent email and its lifecycle status.

Each email carries a non-enumerable `public_id` used in dashboard URLs, an
optional SES `message_id` (the correlation key for downstream events), and
denormalized recipient/attachment metadata. Bodies are stored inline; large
MIME payloads are out of scope for this schema.

# `t`

```elixir
@type t() :: %SquatchMail.Email{
  __meta__: term(),
  adapter: term(),
  attachments: term(),
  attachments_count: term(),
  error: term(),
  events: term(),
  from_email: term(),
  from_name: term(),
  has_attachments: term(),
  headers: term(),
  html_body: term(),
  id: term(),
  inserted_at: term(),
  mailer: term(),
  message_id: term(),
  provider_options: term(),
  public_id: term(),
  recipients: term(),
  sent_at: term(),
  status: term(),
  subject: term(),
  tags: term(),
  text_body: term(),
  updated_at: term()
}
```

# `changeset`

```elixir
@spec changeset(t(), map()) :: Ecto.Changeset.t()
```

Builds a changeset for an email. A `public_id` is generated automatically when
one is not supplied.

# `statuses`

```elixir
@spec statuses() :: [String.t()]
```

Returns the list of valid email statuses.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
