# `Email`

An email address, checked as one.

Use it for any address you send to or sign someone in with. To keep the name shown beside the address, use [`EmailWithName`](/docs/types/type-email-with-name.md). Either is personal data with no `personal:` on the field: it counts as `PersonalData.contact`.

## Shape

One value, with no fields to fill in. As text it reads `someone@example.com`.

## Example

```jadpo
Email("mary@example.com")
```

`text.parse(raw, as: Email)` reads one from text that comes from outside. Text that isn't one at all fails `malformed`, such as `someone`, `someone@` or `@example.com`.

## Good to know

- Checking the form doesn't show that a mailbox exists. To find out, send a message to it.
- `==` tells you whether two are the same. `<` and `list.sort_by` don't take it.
- A field that holds one counts as personal data (`contact`), so you don't mark it yourself.

## In JSON

A string, in a request, a response or `json.write`:

```json
"someone@example.com"
```

## Details

<details>
<summary>Text form, storage, how it is shown, and operations</summary>

`Email` is in the group People and contact, and has been in Jadpo since 0.1.0.

### Text form

`text.from` writes one standard text form, the same form `text.parse` reads back: `someone@example.com`.

### How it is stored

It is stored in one column named for the field, of type `text`. `someone@example.com` is stored as `'someone@example.com'`.

### How it is shown to people

`text.format(value, locale:)` shows it to people in their locale.

With `locale: Locale.en_gb`:

| Value | Shown |
|---|---|
| `someone@example.com` | `someone@example.com` |

### Operations

It also takes `text.parse`, `text.from`, `text.format`, `json.read`, `json.write` and `==`. [How every standard type behaves](/docs/every-standard-type-meets-one-contract.md) says how they work.

</details>
