Mail relay: the access-key field is off by default (mail.relay.accessKeyField)

A token issued by hand is set by a developer: setRelayToken() from a script, or mail.relay.token.
The panel field and its route take a token only when the project switches the field on. Docs and
AGENT.md say when such a token is needed and how to set it; a token of another host is refused on
every way in.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 22:25:34 +01:00
co-authored by Claude Fable 5.2
parent 1a11cefffa
commit edee3a321f
11 changed files with 87 additions and 21 deletions
+3 -3
View File
@@ -101,10 +101,10 @@ once there are more than 20.
one visitor; `mail.relay.accountMail`). Limits and the file size come from the service (30 an hour, 200 a day, 10 MB
unless Intecion set others); `mailAttachmentLimit` reports the latter.
- **Plugin option `mail`**: `mail: { relay: false | { url, host, enrol, token, senderName, kind, accountMail,
confirmRateLimit, totalTimeoutMs, timeoutMs, retryBackoffMs, fetchImpl }, graphDeprecationWarning }`; `mailAdapter({ relay })`.
confirmRateLimit, accessKeyField, totalTimeoutMs, timeoutMs, retryBackoffMs, fetchImpl }, graphDeprecationWarning }`; `mailAdapter({ relay })`.
- **Panel:** the state block on the e-mail tab (transport in effect, the site's state with the service, sender and
reply address, what is left of the limits, a replaced sender name; "Check now", "Connect again", "Disconnect",
"Enter an access key"); "Sending method" reads "Automatic" / "Microsoft Graph (deprecated)"; the server field reads
reply address, what is left of the limits, a replaced sender name; "Check now", "Connect again", "Disconnect";
"Enter an access key" for a token issued by hand only with `mail.relay.accessKeyField: true`); "Sending method" reads "Automatic" / "Microsoft Graph (deprecated)"; the server field reads
"Own SMTP server"; the test e-mail names the transport it used. New status codes `relay-*` with texts in English
and Polish. With `relay: false` the tab is worded as in 1.16.
- **Doctor:** `mail-transport`, `mail-relay-state`, `mail-reply-address`, `mail-graph-deprecated`, `mail-relay-route`;
+9
View File
@@ -1316,6 +1316,7 @@ overrides per adapter; `resolveRelayOptions` reads what is in effect):
| `url` | `RELAY_BASE_URL` | a relay of your own (same contract) |
| `host` | host of `serverURL` (`relayHost`, `isPublicHost`) | the public host the service calls back |
| `enrol` | `'auto'` | `'manual'` (only "Connect again" / `enrolRelay`), `false` (token from `token` / `setRelayToken`) |
| `accessKeyField` | `false` | `true`: admins get "Enter an access key" in the state block (a hand-issued token) |
| `token` | — | a token from elsewhere; nothing is stored, the site does not enrol |
| `senderName` | panel → site name (`relaySenderName`) | fixed name or function |
| `kind` | — | kind of a message nobody marked |
@@ -1354,6 +1355,14 @@ needs more: Intecion raises the limits, or SMTP.
| Constants | `RELAY_BASE_URL`, `RELAY_CONFIRM_PATH`, `RELAY_CONTRACT_VERSION`, `RELAY_DEFAULTS`, `RELAY_KV_KEY`, `RELAY_PRODUCT`, `RELAY_SENDER_ADDRESS`, `RELAY_SERVICE_NAME` |
| Tests without the service | `createFakeRelay` (`FakeRelay`, `FakeRelayOptions`, `FakeRelayMail`, `FakeRelayLimits`): `mailAdapter({ relay: { url: fake.url, fetchImpl: fake.fetch } })`, then assert on `fake.outbox` |
**A token issued by hand** is needed only for a site the service cannot call back (behind a firewall or basic
auth, on a private network). Intecion issues it for the site's host; you set it, never the client: once from a
script — `await setRelayToken(payload, token)` under `pnpm payload run` (stored in `payload.kv`, rotated by the
plugin) — or as the deployment's secret, `mail: { relay: { enrol: false, token: () => process.env.MY_MAIL_TOKEN } }`.
The panel has no field for it unless the project sets `mail: { relay: { accessKeyField: true } }`. Such a site
cannot heal by itself: after a move to another server it reports `relay-refused` until Intecion adds the address
or issues a new token. A token of another host is refused on every way in.
**Never:** read or print the token (`payload.kv`, key `iapl:mail-relay`); add a field or env variable for it; call
the service from a client component; retry a failed send in a loop of your own; mark form mail as `account`.
+1 -1
View File
@@ -101,7 +101,7 @@ through this procedure. Ask only when you are missing something you cannot get y
| state block: "Not connected yet" on the production domain | no e-mail was sent yet | **Send test e-mail** (the site enrols on its first send) or "Connect again" |
| `relay-refused` / "The mail service could not reach this site at …" (cause `callback-failed`) | `unreachable` / `timeout`: firewall, private network, wrong public host in `serverURL`; `redirect`: `trailingSlash: true`, apex → `www`, a language redirect; `status`: route blocked, missing (`mail: { relay: false }`?) or another `routes.api`; `confirmation`: a proxy rewrites the answer | `curl -i -X POST https://<host>/api/iapl/mail-relay/confirm -d '{}' -H 'content-type: application/json'` must answer **404 with an empty body, no redirect**; fix `serverURL` / `mail.relay.host`, or ask Intecion to set the site's confirm address (path ending in `/confirm/` with trailing slashes); then "Connect again" (the site does not retry by itself for 15 min). email.md "When the site cannot be confirmed" |
| `relay-refused`, cause `host-not-allowed` / "This site has no public address yet" | the site runs on `localhost`, a private name, or `serverURL` is empty | expected in development (use SMTP / Mailpit there); in production set `serverURL` |
| `relay-refused` on a site whose token was entered by hand ("does not know the server this site now runs on" / "access key … no longer valid") | the site moved or got a second server, or its token expired; a site with a hand-issued token cannot enrol by itself | Intecion adds the server's address, or issues a new token (state block → "Enter an access key") |
| `relay-refused` on a site whose token was entered by hand ("does not know the server this site now runs on" / "access key … no longer valid") | the site moved or got a second server, or its token expired; a site with a hand-issued token cannot enrol by itself | Intecion adds the server's address, or issues a new token — set it with `setRelayToken(payload, token)` from a script (`pnpm payload run`), or in the panel when the project has `mail.relay.accessKeyField: true` (email.md "The token") |
| staging sends nothing after its database was copied from production: "Not connected yet" / "waiting for approval" | expected: production's token is tied to production's host and is not used on the copy; the copy enrolled as itself | Intecion approves the staging host, or staging uses SMTP / `mail: { relay: false }` |
| `relay-pending` / "waiting for approval" | the host is not on Intecion's list | Intecion approves it on the service; nothing to change on the site; the same token then works |
| `relay-suspended` | Intecion stopped the site (abuse, a flood from a form) | contact Intecion; fill in SMTP meanwhile |
+33 -7
View File
@@ -213,11 +213,35 @@ await runWithMailKind('account', () => sendWelcomeMails(payload, user))
`{ revoked }`: when the service could not be reached the site stops using the token at once, but the token
**still works at the service** — the panel says "not confirmed" and keeps it so that "Disconnect" can be pressed
again; only then is it revoked and forgotten.
- **A token of another site is refused.** The access-key field asks the service whose token it is before it stores
anything, and a token stored by a script is checked the same way before its first use (`/v1/status` names the
host): another site's token is not saved, not used and not revoked.
- **A token issued by hand** — for a site the service cannot call back (behind a firewall): Intecion issues one,
an admin enters it in the state block ("Enter an access key"), or a script calls `setRelayToken(payload, token)`.
- **A token of another site is refused, on every way in.** A token stored by a script is checked with the service
before its first use (`/v1/status` names the host), the panel's access-key field asks before it stores anything,
and every request names the site, so the service refuses a foreign token from `relay.token` too
(`host-mismatch`): another site's token is not saved, not used and not revoked.
- **A token issued by hand** — only for a site the service **cannot call back**: behind a firewall or basic auth, on
a private network, or one that cannot serve the confirm route. Every other site enrols by itself and needs none.
Intecion issues the token for the site's host; **a developer sets it**, one of three ways:
```ts
// 1. once, from a script (recommended): pnpm payload run scripts/set-mail-token.ts
// stored in payload-kv like an enrolled token; the plugin rotates it every 90 days
import config from '@payload-config'
import { setRelayToken } from '@intecion/ipal-kit'
import { getPayload } from 'payload'
const payload = await getPayload({ config })
await setRelayToken(payload, process.env.MAIL_TOKEN!) // pass it in the environment of this one run; never commit it
process.exit(0)
```
```ts
// 2. from the deployment's own secret, on every start: nothing is stored, the site never enrols,
// and replacing the token before it runs out is the project's job
iapl({ mail: { relay: { enrol: false, token: () => process.env.MY_MAIL_TOKEN } } })
```
3. In the panel, when the project switches the field on: `mail: { relay: { accessKeyField: true } }` adds
"Enter an access key" to the state block for admins. **Off by default** — without it the block has no such
field and its route takes no token (`403`).
**Such a site cannot heal by itself:** it never enrols on its own. When the service no longer knows its server
address (after a move, or a second server) or its token, the send reports `relay-refused` and the state block
says what to ask Intecion for — the new address added, or a new token.
@@ -241,14 +265,15 @@ Site integrations → E-mail sending starts with "How e-mails are sent" (compone
rendered by the tab's status banner — **no import-map entry of its own, so nothing to regenerate**): the
transport in effect; for the mail service the state (connected, waiting for approval, stopped, not connected and
why), the address mail leaves from, where replies go, what is left of the hour and the day, and a sender name the
service replaced. Buttons: **Check now**, **Connect again**, **Disconnect**, **Enter an access key**.
service replaced. Buttons: **Check now**, **Connect again**, **Disconnect** — and **Enter an access key** only
with `mail.relay.accessKeyField: true` ("The token" above).
Routes (all three need the `admin` role: not logged in → 401, other role → 403; none ever answers with a token):
| Route | What |
|---|---|
| `GET /api/iapl/mail-relay/status` | the transport and the stored state; `?refresh=1` asks the service |
| `POST /api/iapl/mail-relay/connect` | enrol now; with `{ token }` store a token issued by hand |
| `POST /api/iapl/mail-relay/connect` | enrol now; with `{ token }` store a token issued by hand — only with `accessKeyField: true`, otherwise `403` |
| `POST /api/iapl/mail-relay/disconnect` | give the token up |
| `POST /api/iapl/mail-relay/confirm` | **public** — the service's call-back. `404` and no change unless the site itself started an enrolment in the last 5 minutes; **refused** calls are rate-limited (10 a minute per address, `mail.relay.confirmRateLimit`) — a call that carries the nonce is never turned away by the limit, so junk from the same address cannot keep the site from enrolling |
@@ -308,6 +333,7 @@ message); "Connect again" asks at once. Other causes: `host-not-allowed` (not a
| `url` | `RELAY_BASE_URL` (`https://webservices.intecion.net/mail`) | another base address — a relay of your own that speaks the same contract |
| `host` | host of `serverURL` (`relayHost(payload, options)`) | the public host the service calls back |
| `enrol` | `'auto'` | `'manual'`: only "Connect again" or `enrolRelay()` enrols. `false`: never (the token comes from `token` or `setRelayToken`) |
| `accessKeyField` | `false` | `true` shows "Enter an access key" in the state block and lets its route store a hand-issued token an admin pastes |
| `token` | — | a token from elsewhere (`string` or a function): the stored token is not used and the site does not enrol |
| `senderName` | panel, then site name | a fixed name, or a function |
| `kind` | — | the kind of a message nobody marked |
+1 -1
View File
@@ -1006,7 +1006,7 @@ token. What protects it, and what the new public route can and cannot do:
| **No key in the package** | The plugin carries the service's address and nothing else. A site gets its token by proving it is served at its host: it makes a nonce, the service calls `POST https://<host>/api/iapl/mail-relay/confirm` with the nonce and a token, and only an answer that hashes both makes the token valid |
| **Where the token is** | `payload-kv`, key `iapl:mail-relay`. The collection refuses every operation through access control (`read`, `create`, `update`, `delete` are `false`) and is hidden: REST, GraphQL and the panel cannot reach it — an admin included (test: `test/mailRelayHttp.test.ts`). Server code with the Local API can, like `smtpPassword`. It is stored as it is (no encryption at rest), never logged, never sent to a browser, never part of a route's answer |
| **A database copied to another host** | both sides hold a token to its host: every request names the site (`X-Intecion-Site`) and the service refuses another host's token (`host-mismatch`); and on the site the token is tied to the host it was issued for: a copy on a staging domain does not use production's token — it forgets it, without revoking it, and enrols as itself |
| **A token of another site** (pasted into the access-key field, stored by a script) | refused: the service is asked which host the token is for before it is stored or used; a foreign one is not saved, not used, not revoked |
| **A token of another site** (stored by a script, set as `relay.token`, or pasted into the access-key field — which is off unless the project sets `mail.relay.accessKeyField`) | refused: the service is asked which host the token is for before it is stored or used; a foreign one is not saved, not used, not revoked |
| **A token read from a database dump** | **works from the same server** (a staging site on the machine production runs on shares its outgoing address) — which is why the store is tied to its host, above. From another server it does not work: the service accepts a token only from the addresses the site enrolled from (IPv6: the same `/64`) and answers anything else "enrol again" — which needs the call-back to the real site. It cannot send as another site, and the limits below apply |
| **What a token can do at most** | send within the site's limits (30 an hour, 200 a day, 10 recipients, 10 MB by default) from the service's fixed address, under a sender name the service checks, with `X-Intecion-Site: <host>` on every mail. It cannot set `From`, `Return-Path` or any header, and cannot address a security alert |
| **The confirm route** | public by design, `404` with an empty body unless the body carries a nonce **this site** made in the last 5 minutes (kept as a hash, compared in constant time, single use). It stores the delivered token **beside** the one in use and never replaces a working token: a token becomes the one in use only after the service has accepted it — a `200`, or a refusal the service gives after it has checked the token; no answer, an error page or `rate-limited` prove nothing and leave both as they are. **Refused** calls are rate-limited per address (10 a minute, `mail.relay.confirmRateLimit`); the nonce is looked up first, so junk from the address the service shares with others cannot keep the site's own enrolment out. A stranger who calls it learns nothing and changes nothing |
+1 -1
View File
@@ -101,7 +101,7 @@ through this procedure. Ask only when you are missing something you cannot get y
| state block: "Not connected yet" on the production domain | no e-mail was sent yet | **Send test e-mail** (the site enrols on its first send) or "Connect again" |
| `relay-refused` / "The mail service could not reach this site at …" (cause `callback-failed`) | `unreachable` / `timeout`: firewall, private network, wrong public host in `serverURL`; `redirect`: `trailingSlash: true`, apex → `www`, a language redirect; `status`: route blocked, missing (`mail: { relay: false }`?) or another `routes.api`; `confirmation`: a proxy rewrites the answer | `curl -i -X POST https://<host>/api/iapl/mail-relay/confirm -d '{}' -H 'content-type: application/json'` must answer **404 with an empty body, no redirect**; fix `serverURL` / `mail.relay.host`, or ask Intecion to set the site's confirm address (path ending in `/confirm/` with trailing slashes); then "Connect again" (the site does not retry by itself for 15 min). email.md "When the site cannot be confirmed" |
| `relay-refused`, cause `host-not-allowed` / "This site has no public address yet" | the site runs on `localhost`, a private name, or `serverURL` is empty | expected in development (use SMTP / Mailpit there); in production set `serverURL` |
| `relay-refused` on a site whose token was entered by hand ("does not know the server this site now runs on" / "access key … no longer valid") | the site moved or got a second server, or its token expired; a site with a hand-issued token cannot enrol by itself | Intecion adds the server's address, or issues a new token (state block → "Enter an access key") |
| `relay-refused` on a site whose token was entered by hand ("does not know the server this site now runs on" / "access key … no longer valid") | the site moved or got a second server, or its token expired; a site with a hand-issued token cannot enrol by itself | Intecion adds the server's address, or issues a new token — set it with `setRelayToken(payload, token)` from a script (`pnpm payload run`), or in the panel when the project has `mail.relay.accessKeyField: true` (email.md "The token") |
| staging sends nothing after its database was copied from production: "Not connected yet" / "waiting for approval" | expected: production's token is tied to production's host and is not used on the copy; the copy enrolled as itself | Intecion approves the staging host, or staging uses SMTP / `mail: { relay: false }` |
| `relay-pending` / "waiting for approval" | the host is not on Intecion's list | Intecion approves it on the service; nothing to change on the site; the same token then works |
| `relay-suspended` | Intecion stopped the site (abuse, a flood from a form) | contact Intecion; fill in SMTP meanwhile |
@@ -8,6 +8,7 @@ import { RELAY_CONNECT_PATH, RELAY_DISCONNECT_PATH, RELAY_STATUS_PATH } from '..
type Window = { limit: number; remaining: number }
type State = {
accessKeyField?: boolean
error?: string
message?: string
ok?: boolean
@@ -37,7 +38,8 @@ const warn = { ...line, color: 'var(--theme-warning-600, #b45309)' } as const
* in effect (the Intecion mail service, the site's SMTP server, Microsoft Graph), and for the mail
* service: the state, the address mail leaves from, where replies go, what is left of the limits, and
* a sender name the service did not accept. "Check now" asks the service; "Connect again" and
* "Disconnect" act on the site's connection. No token is ever shown or sent to this component.
* "Disconnect" act on the site's connection; "Enter an access key" is there only with
* `mail.relay.accessKeyField: true`. No token is ever shown or sent to this component.
*
* Rendered by IntegrationStatusBanner on the e-mail tab (`mailRelay` prop) — it has no import-map entry of its
* own; a project's own panel can import it from `/admin`. Texts: `mailRelay*` keys.
@@ -133,12 +135,14 @@ export const MailRelayStatus = () => {
{text('mailRelayDisconnect')}
</button>
) : null}
<button className="btn btn--style-none btn--size-small" onClick={() => setShowToken((v) => !v)} style={{ margin: 0, textDecoration: 'underline' }} type="button">
{text('mailRelayToken')}
</button>
{state.accessKeyField ? (
<button className="btn btn--style-none btn--size-small" onClick={() => setShowToken((v) => !v)} style={{ margin: 0, textDecoration: 'underline' }} type="button">
{text('mailRelayToken')}
</button>
) : null}
</div>
)}
{showToken ? (
{showToken && state.accessKeyField ? (
<div style={{ marginTop: '.75rem' }}>
<p style={{ fontSize: '.85rem', margin: 0, opacity: 0.75 }}>{text('mailRelayTokenHint')}</p>
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '.5rem', marginTop: '.35rem' }}>
+7
View File
@@ -9,6 +9,13 @@ import { RELAY_BASE_URL } from './constants.js'
* switches the transport, the enrolment and the confirm route off.
*/
export type RelayOptions = {
/**
* Show "Enter an access key" in the panel's state block, and let its route store a token an admin pastes.
* Default `false`: a token issued by hand (for a site the service cannot call back) is set by a developer —
* `setRelayToken(payload, token)` in a script, or `token` below. `true` gives admins the field. Either way a
* token of another site is refused.
*/
accessKeyField?: boolean
/**
* "Forgot password" is a visitor's lever like a form: the service lets `account` mail use the site's
* whole hour. So the plugin limits it itself, per address and per visitor (the request's address).
+7 -1
View File
@@ -24,6 +24,8 @@ type Settings = {
/** What the state block on the e-mail tab shows. Never a token, never a password. */
export type MailPanelState = {
/** `mail.relay.accessKeyField`: the panel shows "Enter an access key". Off by default. */
accessKeyField?: boolean
/** The address the service calls this site back at. */
confirmUrl?: string
/** Enabled in the project (`mail.relay` is not `false`). */
@@ -60,6 +62,7 @@ export async function mailPanelState(req: Pick<PayloadRequest, 'payload'>, own:
}
const api = payload.config.routes?.api ?? '/api'
return {
...(options?.accessKeyField === true ? { accessKeyField: true } : {}),
...(status?.host ? { confirmUrl: `https://${status.host}${api}${RELAY_CONFIRM_PATH}` } : {}),
relay: status ? { ...status, senderAddress: status.senderAddress ?? RELAY_SENDER_ADDRESS } : null,
replyAddress: typeof settings.smtpFromAddress === 'string' && settings.smtpFromAddress.trim() ? settings.smtpFromAddress.trim() : null,
@@ -104,7 +107,8 @@ async function answer(req: PayloadRequest, own: false | RelayOptions | undefined
/**
* The three admin-only routes behind the state block on Site integrations → E-mail sending:
* GET /api/iapl/mail-relay/status the transport in effect and the site's state (`?refresh=1` asks the service)
* POST /api/iapl/mail-relay/connect enrol now — or, with `{ token }`, store a token Intecion issued by hand
* POST /api/iapl/mail-relay/connect enrol now — or, with `{ token }` and `mail.relay.accessKeyField: true`,
* store a token Intecion issued by hand (refused otherwise)
* POST /api/iapl/mail-relay/disconnect give the token up; nothing is sent through the service until "Connect again"
* None of them ever answers with a token.
*/
@@ -133,6 +137,8 @@ export function relayPanelEndpoints(own?: false | RelayOptions): Endpoint[] {
/* no body: plain "connect again" */
}
if (typeof body.token === 'string' && body.token.trim()) {
// the field is off unless the project switched it on: a token is then set in code or by a script only
if (options.accessKeyField !== true) {return json({ error: serverText(i18n, 'mailRelayForbidden'), ok: false }, 403)}
const pasted = body.token.trim()
if (!/^ims_[\w-]{43}$/.test(pasted)) {return json({ error: serverText(i18n, 'mailRelayTokenInvalid'), ok: false }, 400)}
// Ask the service whose token this is BEFORE it replaces anything: a token of another site, or one the
+3
View File
@@ -1013,6 +1013,9 @@ describe('what the panel is told', () => {
const smtp = relayPayload({ integrations: { smtpHost: 'smtp.example.com', smtpPassword: 'x', smtpUser: 'u' } })
expect((await mailPanelState(smtp, {})).transport).toBe('smtp')
expect(await mailPanelState(fresh, false)).toMatchObject({ relay: null, transport: 'none' })
// the access-key field is the project's switch, off by default
expect(state.accessKeyField).toBeUndefined()
expect((await mailPanelState(fresh, { accessKeyField: true })).accessKeyField).toBe(true)
expect(JSON.stringify([state])).not.toContain('ims_')
})
})
+13 -2
View File
@@ -47,6 +47,9 @@ const fake = createFakeRelay({
},
})
// the access-key field is off by default; one test switches it on (the plugin reads the options on every request)
const relayOptions: { accessKeyField?: boolean; fetchImpl: typeof fetch; url: string } = { fetchImpl: fake.fetch, url: fake.url }
const makeConfig = (mail?: Parameters<typeof iapl>[0]['mail'], name = 'relayhttp') =>
buildTestConfig({
admin: { user: 'users' },
@@ -82,7 +85,7 @@ const api = (pathname: string, headers: Record<string, string> = {}, init: Reque
const post = (pathname: string, headers: Record<string, string>, body?: unknown) => api(pathname, headers, { body: body === undefined ? undefined : JSON.stringify(body), method: 'POST' })
beforeAll(async () => {
const config = makeConfig({ relay: { fetchImpl: fake.fetch, url: fake.url } })
const config = makeConfig({ relay: relayOptions })
payload = await getPayload({ config })
server = await startPayloadServer(config)
await payload.updateGlobal({ slug: 'site-integrations' as never, data: { smtpFromAddress: '[email protected]', smtpFromName: 'Kancelaria Example' } as never })
@@ -205,8 +208,16 @@ describe('the state routes are for admins', () => {
})
test('"Disconnect" and "Connect again" work for an admin, and neither shows a token', async () => {
// a token of another site pasted while the site is connected: refused, and the site's own token stays
// by default there is no access-key field: the state does not offer it and the route takes no token at all
const mine = (await readRelayStore(payload)).token
expect(((await (await api('/iapl/mail-relay/status', admin)).json()) as { accessKeyField?: boolean }).accessKeyField).toBeUndefined()
const closed = await post('/iapl/mail-relay/connect', admin, { token: fake.issueToken(HOST) })
expect(closed.status).toBe(403)
expect((await readRelayStore(payload)).token).toBe(mine)
// a project switches the field on: mail.relay.accessKeyField
relayOptions.accessKeyField = true
expect(((await (await api('/iapl/mail-relay/status', admin)).json()) as { accessKeyField?: boolean }).accessKeyField).toBe(true)
// a token of another site pasted while the site is connected: refused, and the site's own token stays
const stranger = fake.issueToken('someone-else.example.org')
expect((await post('/iapl/mail-relay/connect', admin, { token: stranger })).status).toBe(400)
expect((await readRelayStore(payload)).token).toBe(mine)