# Connect Fastmail

> Connect Fastmail with an API token over JMAP (recommended) or with an app password over IMAP and SMTP.

Source: https://docs.posternmail.app/providers/fastmail/

Fastmail offers two ways in. The Hub recommends the API token, because JMAP tells the Hub about
changes in every folder at once.

| | API token (JMAP) | App password (IMAP and SMTP) |
|---|---|---|
| Button in the dialog | **Use an API token** (marked **Recommended**) | **Use a password** |
| Live updates | Push for all folders | Push for the inbox (IDLE), other folders every 2 minutes |
| Folders | A message can be in several folders (Fastmail's labels) | One folder per message |
| Sent copy | Fastmail files it | The Hub saves it in Sent |

JMAP support in Postern is newer and less tested than IMAP. If something looks wrong, the app
password is the proven path. See [JMAP](https://docs.posternmail.app/providers/jmap/).

The Hub recognizes `fastmail.com` and many of Fastmail's other domains (`fastmail.fm`,
`fastmail.de`, `sent.com`, `messagingengine.com`, ...), and your own domain when its MX records
point to `*.messagingengine.com`.

## Option A: API token (JMAP)

### 1. Create the token

1. Sign in to Fastmail and open **Settings → Privacy & Security → Integrations**
   (<https://app.fastmail.com/settings/security/integrations>).
2. Under **API tokens**, click **Manage** and then **New API token**.
3. Name it `Postern`. Give it access to **Email** (not read-only) and **Email submission**
   (needed to send).
4. Click **Generate** (Fastmail may ask for your password) and copy the token. It starts with
   `fmu1-`. Fastmail shows it only once.

Fastmail's help center: <https://www.fastmail.help/> (search for "API tokens").

> **Check:** the API tokens list shows `Postern` with Email and Email submission access.

> **If it did not work:** if you cannot find **API tokens**, use the app password (Option B)
> instead.

### 2. Add the mailbox

1. **Settings → Mailboxes → Add mailbox**, pick **Other**, type your Fastmail address and click
   **Continue**.
2. Choose **Use an API token**. The dialog says: "Best: create an API token in Fastmail
   (Settings → Privacy & Security → Integrations → API tokens) with Email and Email submission
   access for instant updates over JMAP. Alternatively create an app password for IMAP/SMTP."
3. Paste the token into **API token** and click **Connect**. Leave **Server address** as it is
   (`https://api.fastmail.com/jmap/session`).
4. The token form has no name field. Set the name people see on your mail afterwards under
   **Settings → Mailboxes → Sender name**.

> **Check:** the dialog shows **you@fastmail.com is connected**; **Settings → Mailboxes** shows
> **Fastmail · Downloading mail, …% done**.

> **If it did not work:** **The sign-in was rejected** means the token is wrong, revoked or
> lacks access. Create a new one with both access types.

## Option B: App password (IMAP and SMTP)

### 1. Create the app password

1. In Fastmail open **Settings → Privacy & Security → Integrations** and, under **App
   passwords**, click **New app password**.
2. Name it `Postern` and choose access **Mail (IMAP/POP/SMTP)**.
3. Click **Generate** and copy the password.

> **Check:** the app passwords list shows `Postern`.

> **If it did not work:** make sure you chose an access type that includes IMAP and SMTP.

### 2. Add the mailbox

1. **Settings → Mailboxes → Add mailbox**, pick **Other**, type your address, click
   **Continue** and choose **Use a password**.
2. Paste the app password into **App password**, optionally fill **Your name on outgoing mail**
   and click **Connect**.

> **Check:** **Settings → Mailboxes** shows **Fastmail · Downloading mail, …% done**.

> **If it did not work:** see [Troubleshooting](https://docs.posternmail.app/providers/fastmail/#troubleshooting).

## Server settings

| | Server | Port | Security |
|---|---|---|---|
| JMAP session URL | `https://api.fastmail.com/jmap/session` | 443 | HTTPS |
| Incoming (IMAP) | `imap.fastmail.com` | 993 | TLS |
| Outgoing (SMTP) | `smtp.fastmail.com` | 465 | TLS |
| Username (IMAP) | your full Fastmail address | | |

## What the Hub does with Fastmail

**Over JMAP:**

- Folders are Fastmail's mailboxes; a message can be in several. Inbox, Sent, Drafts, Archive,
  Trash and Spam are recognized by their roles. If Archive is missing, the Hub creates it the
  first time you archive.
- Tags are saved as JMAP keywords. Read, flagged and answered states are synced both ways.
- New mail and every other change arrive through Fastmail's push stream. The Hub also checks
  every 5 minutes.
- Sending: the message is uploaded, submitted and moved to Sent by Fastmail. Fastmail picks the
  sending identity that matches your From address: the exact address, then a `*@domain`
  identity, then your first identity.
- Spam: marking as spam moves the message to Spam and sets the `$junk` keyword; marking it as not spam
  sets `$notjunk`.

**Over IMAP:** as for [any IMAP server](https://docs.posternmail.app/providers/imap/#what-the-hub-does): IMAP IDLE on the inbox,
all folders checked every 2 minutes, a copy of sent mail saved in Sent.

## Aliases and custom domains

- With a custom domain on Fastmail, use your Fastmail login address (or the custom address) as
  the mailbox address; the Hub finds Fastmail from your MX records.
- To send from an alias, set it up as a sending identity in Fastmail's settings first, then add
  it in Postern under **Settings → Identities & signatures → Add an
  address**. Over JMAP, an address Fastmail does not know is sent with your first identity.

## Troubleshooting

| Symptom | Cause | Fix |
|---|---|---|
| **The sign-in was rejected.** (API token) | The token is wrong, revoked, or has no Email access. | Create a new token with **Email** and **Email submission**. |
| Reading works, sending fails (API token) | The token lacks **Email submission**. | Create a new token with both access types and use **Update sign-in**. |
| **The sign-in was rejected.** (app password) | Wrong password, or the app password's access does not include IMAP and SMTP. | Create a new app password with **Mail (IMAP/POP/SMTP)**. |
| Mail sent from an alias shows your main address | The alias is not a Fastmail sending identity. | Add it in Fastmail first. |
| Something looks wrong with a JMAP mailbox | JMAP is less tested. | Use **Download again…**; if it persists, connect with an app password instead and report the problem. |

To disconnect, remove the mailbox in Postern and delete the token or app password in
**Settings → Privacy & Security → Integrations**.
