Mail relay: review round 2 — the store is keyed by host, a copied database does not enrol by itself

- Q-1 one entry per host (iapl:mail-relay:site:<host>); a read never deletes or writes; another host's
  entry is neither used nor touched (a developer's process on the live database, www and apex, a copy)
- a database that holds another host's connection and none of this site's does not enrol by itself:
  "Connect again" does, once; mail.relay.otherHosts ('wait' | 'enrol' | the site's own other hosts);
  panel text and doctor finding; a site with an empty store enrols by itself as before
- Q-2 the file limit answers from what is stored and never asks the service
- Q-3 a file whose mail was not confirmed is not reported as a wrong file, and no notice mail follows
- Q-4 its own text when the access-key field is off
- D-1 docs for open enrolment; staging, copies and several hosts

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 23:14:11 +01:00
co-authored by Claude Fable 5.2
parent edee3a321f
commit 85ed92bb89
31 changed files with 467 additions and 211 deletions
+8 -2
View File
@@ -1282,7 +1282,12 @@ the mail service → nothing (`mail: { relay: false }` and no SMTP). A site with
3. The server may call `https://webservices.intecion.net`.
4. Site integrations → E-mail sending: "Sender name" (else the site name is used) and **"Sender address"** — with
the mail service that is where replies go; the service's own address has no mailbox.
5. Intecion has listed the host; otherwise the site enrols and waits for approval (`relay-pending`).
5. Nothing to arrange with Intecion: a site that passes the call-back is active at once (`relay-pending`, held for
approval, is the exception — the panel says so).
6. **Staging made from a copy of production's database** does not connect by itself (it would mail production's
real addresses): it stays "not connected" until an admin presses "Connect again". For a copy that must never
send: `mail: { relay: false }` or SMTP to a catcher. After a **domain move** press "Connect again" once, or set
`mail: { relay: { otherHosts: ['old-domain.example'] } }`. A site before launch (empty store) enrols by itself.
**Verify:** Site integrations → E-mail sending → the block "How e-mails are sent" says "Connected to IWSN"; **Send test e-mail** answers "through IWSN, as <name>"; the mail arrives from
`notification@webservices.intecion.net` with the client's name and `Reply-To` the client's address; `iapl-doctor
@@ -1315,6 +1320,7 @@ overrides per adapter; `resolveRelayOptions` reads what is in effect):
| `relay: false` | on | no mail service: no outbound call, no routes, no state block |
| `url` | `RELAY_BASE_URL` | a relay of your own (same contract) |
| `host` | host of `serverURL` (`relayHost`, `isPublicHost`) | the public host the service calls back |
| `otherHosts` | `'wait'` | a database holding another host's connection and none of this site's (a copy, a moved domain): wait for "Connect again"; a list of the site's own other hosts; or `'enrol'` |
| `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 |
@@ -1363,7 +1369,7 @@ The panel has no field for it unless the project sets `mail: { relay: { accessKe
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
**Never:** read or print the token (`payload.kv`, keys `iapl:mail-relay:…`, one entry per host); 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`.
---