# Domains and addresses

A team's mail lives on the team's own domain, such as `alnoor.example`. A leader adds the
domain on the team's **Mail** tab, proves it with DNS records, and then gives each person
an address on it. The tab is there while the team has Mail on (the **General** tab).

## Adding a domain

1. On **Mail**, press **Add domain**, type the domain and press **Add**.
2. The tab shows two records to add at your DNS provider, in a table of **Type**,
   **Name**, **Value** and **State**. Press a value to copy it.

| Type | What it is for |
|---|---|
| TXT | Proves the domain is yours. Its value begins with `theorem-verify=`. |
| MX | Brings the domain's mail to Theorem. |

3. Wait, then press **Check again**. Each record's **State** says **Found**,
   **Partly found**, **Not yet**, **Another value** or **Not checked**.

DNS changes take time to spread, usually up to an hour. Theorem also checks by itself: every
five minutes for a domain's first two days, then every hour until it is 30 days old.
**Check again** asks at once, at most once in ten seconds.

The domain is the team's once the TXT record is seen. Once every record is found, the
domain says **Verified**. Until then its line says where it stands, such as **Waiting for
its records** or **Proved. Not receiving yet**.

- A team may hold 5 domains.
- A domain can be held by one team at a time. Until a team proves it, two teams may both
  add it: the first to prove it has it, and the other then sees **Another team has proved
  it**. Once it is proved, another team's **Add** is refused.
- A domain can't be added while people sign in to Theorem with an address on it, or are
  invited at one, because their sign-in links would then arrive in a mailbox they must be
  signed in to read. The refusal says how many people, never who.
- The MX record sends the domain's mail to Theorem. If the domain receives mail elsewhere
  today, that mail comes to Theorem instead once the record is in place.

## Giving addresses

Once a domain is proved, the tab lists the team's people under **Addresses**: every member,
and everyone still invited. In a person's row menu, choose **Give an address**, type the
part before the @ and choose the domain.

- 3 to 32 characters of a to z and 0 to 9, with a single `.`, `-` or `_` between them.
- `postmaster` and `abuse` can't be given: mail to them reaches a leader's mailbox on that
  domain.
- One address per person on a domain. Nobody chooses their own.

The mailbox is made at once, so mail can arrive before the person first comes.

## When people leave

An address stays with the team when its person leaves. Its row then says **Not in the
team**, and **Give it to someone else** hands the mailbox, with its mail, calendar and
contacts, to another person. **Take it back** removes an address given by mistake, only
while its mailbox is empty, and cannot be undone.

## What mail on the domain can do

Mail on a team's domain is received from anywhere. It can be sent only to addresses on
domains Theorem hosts: the tab says **Mail from it can only go to addresses on Theorem for
now.** See [Mail](/workspace/mail).

A domain can be removed with **Remove domain** only when no address is on it, a person's
or a role's. An address whose mailbox holds mail stays with the team, and so does its
domain.
