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
+4 -3
View File
@@ -39,8 +39,9 @@ once there are more than 20.
| SMTP filled in (server, user name, password) | Nothing. No call to Intecion | — |
| `GRAPH_*` set and "Microsoft Graph" chosen | Mail as before. One deprecation warning in the start log, one doctor warning (`mail-graph-deprecated`) | `mail: { graphDeprecationWarning: false }` (the log line) |
| `GRAPH_*` set, "Sending method" on SMTP, no SMTP server (mail failed until now) | Mail goes through Graph | fill in SMTP, or remove the variables |
| Neither (mail failed until now with "not configured") | **An outbound call:** on the next e-mail the site enrols with the service — `POST https://webservices.intecion.net/mail/v1/enrol` with its host and the plugin version — and then sends through it, from `[email protected]`. A host Intecion has not listed waits for approval first | `iapl({ mail: { relay: false } })` |
| Neither (mail failed until now with "not configured") | **An outbound call:** on the next e-mail the site enrols with the service — `POST https://webservices.intecion.net/mail/v1/enrol` with its host and the plugin version — and then sends through it, from `[email protected]`. The site is active as soon as it enrols (the service holds a site for approval only as an exception) | `iapl({ mail: { relay: false } })` |
| Any site with the mail service enabled (the default) | **A new public route:** `POST /api/iapl/mail-relay/confirm` — answers `404` and changes nothing unless the site itself started an enrolment in the last 5 minutes; rate-limited. Three admin-only routes beside it (`…/status`, `…/connect`, `…/disconnect`) | `mail: { relay: false }` removes all four |
| **A copy** of a site's database on another host (staging made from production), with no SMTP there | It does **not** connect by itself — its data is production's, and it would mail real people: sends report `relay-refused`, the panel and the doctor say why. "Connect again" lets it send; `mail: { relay: false }` or SMTP to a catcher keeps it silent for good | `mail: { relay: { otherHosts: 'enrol' } }` |
| SMTP **half** filled in — a server or a user name, but not server, user name and password (until now: refused, "Fill in the server, user name and password") | Sent through the mail service; one line in the server log and a hint in the state block say that the SMTP settings are incomplete | complete or empty the SMTP fields; `mail: { relay: false }` |
| "Microsoft Graph" chosen in the panel but `GRAPH_*` missing (until now: SMTP with a warning) | SMTP if filled in, otherwise the mail service | as above |
| A site on `localhost` or without `serverURL` | Refused by the plugin itself; nothing leaves the machine. Development: SMTP (a local catcher) as before | — |
@@ -88,7 +89,7 @@ once there are more than 20.
The admin panel calls it **IWSN**; docs, logs and the doctor use the full name.
`mailAdapter()` now picks per send: Graph when the panel says so and `GRAPH_*` is set → SMTP when the panel has a
server → Graph when `GRAPH_*` is set → the mail service → not configured (`resolveMailTransport`). The site holds no
mail key: it enrols by a call-back to its own domain and keeps its token in `payload-kv` (key `iapl:mail-relay` —
mail key: it enrols by a call-back to its own domain and keeps its token in `payload-kv` (one entry per host, `iapl:mail-relay:site:<host>` —
no field, no column; not readable over REST or GraphQL, an admin included; proven by a test). The token is bound to
the site's server addresses and to the host it was issued for (a database copied to another host enrols as itself),
rotated every 90 days, healed by re-enrolment. One message = one `Idempotency-Key` and
@@ -101,7 +102,7 @@ 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, accessKeyField, totalTimeoutMs, timeoutMs, retryBackoffMs, fetchImpl }, graphDeprecationWarning }`; `mailAdapter({ relay })`.
confirmRateLimit, accessKeyField, otherHosts, 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" for a token issued by hand only with `mail.relay.accessKeyField: true`); "Sending method" reads "Automatic" / "Microsoft Graph (deprecated)"; the server field reads
+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
`[email protected]` 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`.
---
+2 -2
View File
@@ -102,8 +102,8 @@ through this procedure. Ask only when you are missing something you cannot get y
| `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 — 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 |
| a site sends nothing: "The data comes from another site (…), so this site did not connect by itself" / `relay-refused`, cause `client-other-host` | the database holds another host's connection and none of this site's: a staging copy of production, a moved domain, a second domain. Expected — a copy with production's data must not mail real people by itself | should it send: "Connect again" in the state block, once. A moved or second domain: `mail: { relay: { otherHosts: ['old-domain.example'] } }`. A copy that must never send: `mail: { relay: false }` or SMTP to a catcher |
| `relay-pending` / "waiting for approval" | the exception: the service holds new sites for approval when many appear at once, or Intecion approves by hand (a site is normally active as soon as it enrols) | 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 |
| `relay-disconnected` | an admin pressed "Disconnect" | "Connect again", or SMTP |
| `relay-quota` | the site's hour or day is used up (30 / 200 by default), more than 10 recipients, more than 10 confirmations to one address a day, too many new addresses, or the site's own limit on account mail (`mail.relay.accountMail`) | the server log names the limit; look for a form being abused (Turnstile on? rate limit?); a site that really sends more: Intecion raises the limits, or SMTP |
+1 -1
View File
@@ -646,7 +646,7 @@ scaling (5). `●` routes for pages need the database at build time (PROGRAMISTA
6. **Notifications**: form messages in every language.
7. **Site integrations → E-mail sending**: "Sender name" (the client's name; empty = the site name) and **"Sender
address"** (the client's address: with the mail service replies go there). SMTP fields **only** when the client asked
for its own server. On the production domain: the block "How e-mails are sent" must say "Connected to IWSN" ("waiting for approval" = ask Intecion to approve the host), then **Send test e-mail** → "through IWSN". Turnstile (for testing site
for its own server. On the production domain: the block "How e-mails are sent" must say "Connected to IWSN" (a site is active as soon as it enrols; "waiting for approval" is the exception — ask Intecion; "The data comes from another site" = this database is a copy: press "Connect again" only if the copy should send), then **Send test e-mail** → "through IWSN". Turnstile (for testing site
`1x00000000000000000000AA`, secret `1x0000000000000000000000000000000AA`; production keys from the client), analytics/pixel
IDs, IndexNow → generate key. Mail/Turnstile errors show up as a dashboard alert.
8. **Forms**: check the addresses in the Emails tab of the seeded forms.
+5 -2
View File
@@ -571,8 +571,11 @@ PROGRAMISTA §6, item 73; email.md; AGENT.md §7.2) — nothing to run; read whi
`iapl({ mail: { relay: false } })`.
3. **For a site that will use the mail service:** `serverURL` is the public address the site answers on without a
redirect; no proxy or WAF rule blocks `/api/iapl/mail-relay/confirm`; `trailingSlash: true` or another `routes.api` →
Intecion sets the site's confirm address first; "Sender address" is filled in (replies go there); Intecion has listed
the host (otherwise "waiting for approval"); the client's processing agreement names the service.
Intecion sets the site's confirm address first; "Sender address" is filled in (replies go there); the client's
processing agreement names the service. Nothing to arrange with Intecion: the site is active as soon as it enrols.
**A staging copy of the database** does not connect by itself (it would mail production's real addresses): it
says so in the panel until an admin presses "Connect again"; keep it silent with `mail: { relay: false }` or SMTP
to a catcher. After a domain move: "Connect again" once, or `mail: { relay: { otherHosts: ['old-domain.example'] } }`.
4. Code that compared the result of `payload.sendEmail` needs no change for SMTP and Graph. A send through the mail
service returns `{ sent, transport: 'relay', … }`; `sent: false` with `confirmed: false` means "may have been sent".
5. Your own account mail (invitations): mark it — `withMailKind(message, 'account')`. Form mail and Payload's
+7 -3
View File
@@ -54,9 +54,13 @@ Mail needs **no variable**. A site with no SMTP server in the panel sends throug
- **That route reachable from the internet** — no basic auth on the Coolify app, no firewall or WAF rule in front of
`/api/iapl/`; behind Cloudflare leave it uncached and unchallenged.
- **Outbound HTTPS** to `webservices.intecion.net`.
- A staging copy on its own domain enrols as its own site (its own token, its own limits, its own approval) —
**also when its database is a copy of production's**: the stored token is tied to production's host and is not
used on another one. A staging copy that must not send: `iapl({ mail: { relay: false } })` or SMTP to a catcher.
- **Staging.** A site is active as soon as it enrols, so a staging site sends real mail. A staging site made from a
**copy of production's database** does not connect by itself (its data is production's; it stays "not connected"
until an admin presses "Connect again") and never uses or touches production's connection. The safe set-up for a
copy that must not send: `iapl({ mail: { relay: false } })` or SMTP to a catcher ([email.md](./email.md)
"Staging, copies and several hosts").
- **A domain move** (the same database under a new host): press "Connect again" once after the move, or set
`mail: { relay: { otherHosts: ['old-domain.example'] } }` before it.
- Several containers of one site share the database, so they share the token; a restore of an old database dump
brings back an old token — the site then enrols again by itself on its next e-mail.
+1 -1
View File
@@ -113,7 +113,7 @@ Turn off: `iapl({ doctor: false })`. Adapt: `iapl({ doctor: { tokenVar: 'MY_TOKE
| | `storage-names` | warning | the visitor cookie the layout sets (`<PageStats visitorCookie>`, default `ipal_vid`) is the one the config makes the cookie scanner declare (`storageNames`, stats.md) |
| | `cookie-scanner` | error / warning / info | `cookieScanner` on (with `crawl`, else info); deep: nothing waits for approval (warning) |
| mail | `mail-transport` | error / warning | (deep) an e-mail transport is in effect (not: the mail service switched off and no SMTP server); the last sends worked — failing: warning, error once it has lasted 24 hours |
| | `mail-relay-state` | error / warning / info | (deep) on the Intecion mail service: not disconnected and not stopped (error), not waiting for approval, not refused at enrolment, the sender name not replaced (warning); not enrolled yet (info) |
| | `mail-relay-state` | error / warning / info | (deep) on the Intecion mail service: not disconnected and not stopped (error), not waiting for approval, not refused at enrolment, not a copied database that waits for "Connect again" (`client-other-host`), the sender name not replaced (warning); not enrolled yet (info) |
| | `mail-reply-address` | warning | (deep) on the mail service, "Sender address" is filled in: replies go there |
| | `mail-graph-deprecated` | warning | Microsoft Graph is not in use: no `GRAPH_*` variables on the site (deep), no `graphAdapter` / `emailGraph: true` in the config — deprecated, removed in 2.0 |
| | `mail-relay-route` | warning | nothing keeps the mail service from confirming the site: no `trailingSlash: true`, `routes.api` is `/api` (else Intecion sets the site's confirm address); live, on the mail service: `/api/iapl/mail-relay/confirm` answers without a redirect, a block or a server error. Skipped with `relay: false` |
+38 -19
View File
@@ -78,8 +78,10 @@ What the site needs for it:
443, **without a redirect** — the service follows none. No basic auth, no firewall rule, no maintenance page in
front of it. (Coolify: nothing to set; the route is part of Payload's API.)
- **Outbound HTTPS** from the server to `webservices.intecion.net`.
- A host Intecion has **listed** is active at once. Any other host is enrolled but **waits for approval**: mail is
not sent until Intecion approves it, then the same token works. The panel says which it is.
- **A site that passes the call-back is active at once.** Waiting for approval is the exception: the service
holds a new site back when many new sites appear at once (more than a few a day from one address or domain, or
more than its daily number in all), or when Intecion has set it to approve by hand. Mail is then not sent until
Intecion approves the site; the same token works afterwards, and the panel says so.
A site on `localhost`, on a private address or without `serverURL` is refused **by the plugin itself**, before any
call leaves the server — development machines do not contact the service. To test mail locally use SMTP (a local
@@ -126,7 +128,9 @@ The numbers are the service's, per site, and can be changed by Intecion for one
A message over a limit is refused whole (`relay-quota`, `relay-too-large`); the site is not suspended for it.
`mailAttachmentLimit(payload)` reports the file limit the service named, so a form's File field never promises
more ([forms.md](./forms.md) "Files"); until the site has enrolled it is `null` (the plugin has no number of its own).
more ([forms.md](./forms.md) "Files"). It answers from what is stored — never by asking the service while a page
is read — and is renewed after a send, once an hour; until the site has enrolled and sent once it is `null` (the
plugin has no number of its own).
**Account mail is limited by the site itself.** "Forgot password" is a visitor's lever like a form, and the
service lets account mail use the whole hour. So the relay transport holds back more than **5 account e-mails to
@@ -194,13 +198,13 @@ await runWithMailKind('account', () => sendWelcomeMails(payload, user))
### The token
- Kept in Payload's key-value store (`payload.kv`, the `payload-kv` collection Payload itself adds; key
`RELAY_KV_KEY` = `iapl:mail-relay`). **No field, no column, no migration.** That collection refuses every
one entry per host under `RELAY_KV_KEY` = `iapl:mail-relay`). **No field, no column, no migration.** That collection refuses every
operation through access control and is hidden in the panel, so the token cannot be read over REST or GraphQL —
not by an admin either. It is never logged and never sent to a browser.
- **The token belongs to the host it was issued for.** A store found on another host — a production database
copied to a staging domain, a site moved to a new domain — is not used: the copy forgets the token (nothing is
revoked, the other site keeps working), starts unenrolled and enrols as itself, with its own token, limits and
approval. The start log says so once.
- **The token belongs to the host it was issued for, and is stored under that host** (key
`iapl:mail-relay:site:<host>`). A site reads and writes its own entry only; another host's entry in the same
database — production's in a copy, the old domain's after a move, the live site's when a developer's process
reads the live database — is neither used nor touched. **A read never deletes or changes anything.**
- The token works only from the server addresses the site enrolled from. After a move to another server the
service answers "enrol again"; the site does, by the same call-back, and sends. A site whose requests leave from
many changing addresses (serverless, a pool of egress addresses) needs its limit of addresses raised by Intecion.
@@ -248,16 +252,29 @@ await runWithMailKind('account', () => sendWelcomeMails(payload, user))
- Encryption at rest: none, like `smtpPassword`. A token read from a database dump is of little use — it does not
work from another server address.
### Staging and copies
### Staging, copies and several hosts
- A staging site on its own domain is **its own site** to the service: its own enrolment, token, limits and
approval ("waiting for approval" until Intecion approves it, unless its host is listed).
- **A copy of production's database does not carry production's connection.** The stored token is tied to the host
it was issued for; on another host it is forgotten (never revoked), and the copy enrols as itself. This also holds
on the same server, where production's token would otherwise work.
- "Disconnect" on a copy revokes nothing of production's.
- A staging copy that must not send at all: `iapl({ mail: { relay: false } })` there, or SMTP to a catcher.
- Not covered: a copy that keeps production's `serverURL` is the same site to the plugin.
- **A site that passes the call-back is active at once** and can send. A staging site on its own domain is its own
site to the service: its own enrolment, token and limits.
- **A copy of production's database does not connect by itself.** Its data is production's — real customers'
addresses in form submissions and accounts — and a copy that enrolled by itself would mail real people as soon
as a form or a password reset ran. So a site whose database already holds the connection of **another host** and
none of its own stays "not connected": sends report `relay-refused` (cause `client-other-host`), the state block
says "The data comes from another site (…), so this site did not connect by itself", the doctor reports it
(`mail-relay-state`), and no call leaves the server. An admin who wants the copy to send presses **Connect
again**, once; from then on it is a site of its own and heals by itself.
- **A site before launch is not affected:** with an empty store it enrols by itself on its first e-mail.
- **A copy that must never send:** `iapl({ mail: { relay: false } })` there, or SMTP to a catcher. That is the
safe set-up for staging; "not connected" only protects until somebody presses the button.
- **`www.` and the bare domain** are one site: either enrols by itself beside the other (each keeps its own entry).
- **A moved domain** (the same data under a new host) looks like a copy: after the move press **Connect again**
once, or name the old host as the site's own — `mail: { relay: { otherHosts: ['old-domain.example'] } }` — and
the site enrols by itself. The same list is for a second domain of one site.
- **`otherHosts: 'enrol'`** switches the rule off: a site enrols by itself whatever else the database holds.
- Production's connection is never used, changed or revoked by a copy — "Disconnect" on a copy included, and on the
same server too. A developer's process on `localhost` reading the live database changes nothing either.
- Not covered: a copy that keeps production's `serverURL` is the same site to the plugin (and to the service, if it
can be called back at that host).
### The state block in the panel
@@ -290,7 +307,7 @@ the service), each with a text in the editor's language:
| Code | Meaning | What to do |
|---|---|---|
| `relay-pending` | enrolled, waiting for approval by Intecion | Intecion approves the host; nothing to do on the site |
| `relay-pending` | enrolled, but held for approval by Intecion — the exception (many new sites at once, or approval by hand); a site is normally active as soon as it enrols | Intecion approves the host; nothing to do on the site |
| `relay-suspended` | stopped by Intecion | contact Intecion; SMTP in the panel sends meanwhile |
| `relay-refused` | the site could not enrol; or a token issued by hand stopped working (new server address, token no longer valid) | "When the site cannot be confirmed" below; hand-issued: ask Intecion for the address to be added or for a new token |
| `relay-disconnected` | an admin pressed "Disconnect" | "Connect again", or fill in SMTP |
@@ -332,6 +349,7 @@ message); "Connect again" asks at once. Other causes: `host-not-allowed` (not a
| `relay: false` | — | switches the mail service off: no enrolment, no outbound call, no confirm route, no state block, the panel wording of 1.16 |
| `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 |
| `otherHosts` | `'wait'` | a database that holds another host's connection and none of this site's (a copy, a moved domain): `'wait'` = no enrolment until "Connect again"; a list = those hosts are this site's own; `'enrol'` = enrol by itself anyway |
| `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 |
@@ -501,7 +519,8 @@ Works on any `text` field. After wiring it in a project you may need
To the mail service (when the owner says so):
1. Upgrade; check that `serverURL` is the site's public address.
2. Intecion lists the host on the service (or approves it after the first send).
2. Nothing to arrange with Intecion beforehand: the site is active as soon as it enrols (in the rare case that it
is held for approval, the panel says so).
3. Remove the four `GRAPH_*` variables in Coolify and redeploy. If "Sending method" says Microsoft Graph, set it
to "Automatic".
4. Site integrations → E-mail sending → send a test e-mail: the answer says "through IWSN".
+2 -2
View File
@@ -1004,8 +1004,8 @@ 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 |
| **Where the token is** | `payload-kv`, one entry per host (`iapl:mail-relay:site:<host>`). 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 stored under the host it was issued for: a copy on a staging domain neither uses nor touches production's entry (a read never deletes), and **does not enrol by itself** — with production's data it would mail real people — until an admin presses "Connect again" (`mail.relay.otherHosts`) |
| **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 |