Mail relay: contract 1.6.0, the token tied to its host, IWSN in the panel
- contracts/mail-relay refreshed from IWDL 83af8c6 (1.6.0) - an answer that is not the service's JSON is 'not confirmed' unless its status is 400 to 499 - a site with a token issued by hand does not enrol to heal: it stops and says what to ask Intecion for - a store made on another host (a database copied to staging) is not used: the copy enrols as itself, nothing is revoked - the panel calls the service IWSN (RELAY_SHORT_NAME); docs, logs and the doctor keep the full name Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
7d766b6d58
commit
0ee74ab2a4
+22
-8
@@ -1,7 +1,8 @@
|
||||
# email
|
||||
|
||||
Mail works with **no setup**: a site with no SMTP server in the panel sends through the
|
||||
**Intecion Notifications Webservice** (below: "the mail service"), from
|
||||
**Intecion Notifications Webservice** — **IWSN** for short, the name the admin panel uses (constant
|
||||
`RELAY_SHORT_NAME`); below also "the mail service" — from
|
||||
`[email protected]`, under the site's own sender name. Two more transports exist:
|
||||
|
||||
| Transport | When | Sender address |
|
||||
@@ -165,11 +166,17 @@ await runWithMailKind('account', () => sendWelcomeMails(payload, user))
|
||||
- A message is encoded **once**; exactly those bytes go out on every attempt, under one `Idempotency-Key`. At most
|
||||
**three attempts**, 30 seconds each, at most ten seconds of waiting between them in all — and only after an answer
|
||||
the service marks retryable, or after no answer. An enrolment on the way is not one of the three.
|
||||
- **No answer at all** (time-out, connection lost) is reported as `relay-not-confirmed` with `confirmed: false`: the
|
||||
message **may have been sent**. Sending the same message again within 24 hours reuses the same key, so the
|
||||
service answers with what happened to the first attempt (`replayed: true`) and no second mail goes out.
|
||||
- **No answer of the service** — a time-out, a lost connection, or an answer that is not the service's own JSON (an
|
||||
error page of the network in front, a cut-off body) with any status outside 400–499, `200` included — is reported
|
||||
as `relay-not-confirmed` with `confirmed: false`: the message **may have been sent**. Such an answer with a status
|
||||
from 400 to 499 was turned away before the service handled it: `relay-unreachable`, not sent.
|
||||
- **"Not confirmed" is final for that message.** The plugin keeps no unsent mail (no stored outbox), so it does not
|
||||
try again by itself after the report. While the same process is running, the same message sent again within
|
||||
24 hours goes out under the same key — the service then answers with what happened to the first attempt
|
||||
(`replayed: true`) and no second mail goes out. After a restart, or from another instance of the site, a repeat
|
||||
(a visitor submitting the form again) is a new message: if the first one did go out, the recipient gets two.
|
||||
That is why the panel says "it may have been sent; check the mailbox before trying again".
|
||||
- The form **keeps working** meanwhile — the submission is saved in Form Submissions; only the mail is missing.
|
||||
- There is no stored outbox: a message that failed is not sent later by itself.
|
||||
|
||||
### The token
|
||||
|
||||
@@ -177,6 +184,10 @@ await runWithMailKind('account', () => sendWelcomeMails(payload, user))
|
||||
`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 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.
|
||||
@@ -188,6 +199,9 @@ await runWithMailKind('account', () => sendWelcomeMails(payload, user))
|
||||
the site from enrolling by itself until "Connect again" (`enrolRelay(payload, { force: true })`).
|
||||
- **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)`.
|
||||
**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.
|
||||
- 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.
|
||||
|
||||
@@ -223,7 +237,7 @@ the service), each with a text in the editor's language:
|
||||
|---|---|---|
|
||||
| `relay-pending` | enrolled, waiting for approval by Intecion | 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 | "When the site cannot be confirmed" below |
|
||||
| `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 |
|
||||
| `relay-quota` | a limit of the site or of the whole service; too many recipients; the site's own limit on account mail | wait; ask Intecion for other limits; SMTP for a site that sends more |
|
||||
| `relay-too-large` | text or files over the service's limit | a smaller file; `forms.attachments.maxFileSize`; SMTP |
|
||||
@@ -430,7 +444,7 @@ To the mail service (when the owner says so):
|
||||
2. Intecion lists the host on the service (or approves it after the first send).
|
||||
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 the built-in mail service".
|
||||
4. Site integrations → E-mail sending → send a test e-mail: the answer says "through IWSN".
|
||||
5. Check "Sender name" and "Sender address" (now the reply address), and tell the client that mail now comes from
|
||||
`[email protected]` instead of the present mailbox (allow-lists, filters).
|
||||
|
||||
@@ -576,7 +590,7 @@ The large path, step by step, and what happens when it fails:
|
||||
## Test send — button in the panel
|
||||
|
||||
The E-mail sending tab has a **Send test e-mail** button: enter an address, click, and a test mail goes out through
|
||||
the CURRENT transport (`payload.sendEmail`). The answer names the transport ("through the built-in mail service,
|
||||
the CURRENT transport (`payload.sendEmail`). The answer names the transport ("through IWSN,
|
||||
as …", "through your SMTP server") and, for the mail service, the sender name that was used. Tick **Attach a 10 MB
|
||||
test file** to check that a file of that size gets through ("Attachments" above). Endpoint
|
||||
`POST /api/ipal/test-email`, body `{ to, attachmentMB? }` (`admin` role only — needs roles from the `access` option:
|
||||
|
||||
Reference in New Issue
Block a user