Mail relay: docs, agent guide, skills, changelog draft; test against the real service code; starter offers the mail service

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 20:53:38 +01:00
co-authored by Claude Fable 5.2
parent 533f571d4d
commit dd3792cbc7
25 changed files with 991 additions and 167 deletions
+115 -5
View File
@@ -47,7 +47,7 @@ use the name in the middle column. `pnpm exec iapl-doctor` lists what is still o
| Name | Why |
|---|---|
| package `@intecion/ipal-kit` and every import path (`@intecion/ipal-kit/client`, `…/tokens.css`), import-map paths `@intecion/ipal-kit/admin#…`, `node_modules/@intecion/ipal-kit/docs/…` | the package name changes in 2.0 |
| routes `/api/ipal/…` | proxies, cached pages and the crawler call them |
| routes `/api/ipal/…` | proxies, cached pages and the crawler call them (the mail service's four routes, new in 1.17.0, are `/api/iapl/mail-relay/…`) |
| CSS tokens `--ipal-*`, hooks `data-ipal="…"` | projects' own CSS uses them |
| `config.custom.ipal`, `custom.ipalAccounts`, `req.context` flags (`ipalSeed`, `ipalSkipIndexNow`, `ipalSkipAutoFill`, …), `ipalTotpView` server props, translation namespace `ipal` | projects' hooks and overrides read them |
| header `X-Ipal-Cookie-Crawler` | WAF rules |
@@ -121,7 +121,7 @@ the ready-to-send list is in **iapl-setup** stage 0 (iapl-site phase 0 uses the
| Languages | which locales, the default locale, URL structure (`/pl/…` for every language, or the default without a prefix) |
| Styling | a design system / `DESIGN.md` or plain Tailwind tokens, brand colours, fonts, light/dark theme |
| Content | the pages, the collections (blog, case studies, products…), archive pages |
| Forms | which forms, who receives them, e-mail provider (SMTP from the panel or Microsoft Graph) |
| Forms | which forms, who receives them; e-mail: the built-in mail service by default — ask only whether the client wants its **own SMTP server and sender address** (never offer Microsoft Graph: deprecated) |
| Analytics and consent | GA4 / GTM / pixels, Consent Mode basic or advanced, cookie banner mode, cookie scan |
| SEO / GEO | market and local business data, AI crawler policy (llms.txt, Markdown, MCP, AI bots) |
| Data and media | database (Postgres or MongoDB) and its names (`<domain without dots>_prod` / `_dev` — derive, then confirm), media storage (R2 or local disk) |
@@ -1166,7 +1166,7 @@ project → **plugin gap**, not a copy.
| Cookie list filled from the panel (scan, then one approval adds every cookie to the list, the policy table and the detailed window) | `iapl({ cookieScanner: true })` + `pnpm generate:importmap` + migration; the editor approves on `/admin/cookie-approval`; project cookies: `cookieScanner.declarations` / `integrations`; per-entry review: `approval: false` — do not type the list by hand or build your own scanner or approval page | cookie-scanner.md |
| Pre-consent check in a browser (button in the panel, violations, dashboard + e-mail warning) | `cookieScanner: { crawl: true }` + env `IAPL_COOKIE_SCAN_URL` / `IAPL_COOKIE_SCAN_TOKEN` (`iaplEnvRules({ cookieCrawl: true })`) + the site's `host=token` in the shared service's `IAPL_CRAWLER_SITES`; never Playwright/Chromium in the site | cookie-scanner.md → Browser crawl |
| GA4, GTM, Pixel, Clarity, LinkedIn, TikTok | IDs in the panel — `SiteProviders` loads `Analytics` (`analytics={{ defer: true }}`; `consentMode: 'basic'` = no Google request before consent) | analytics.md |
| Mail | `email: mailAdapter()`, `sendEmail` | email.md |
| Mail | `email: mailAdapter()` + `serverURL` — mail works with no other setup, through the Intecion mail service; SMTP in the panel only when the client asks; your own mail: `payload.sendEmail` (`withMailKind` when it is account mail); never a second transport in the project. §7.2 | email.md |
| Env validation, health | `assertEnv(iaplEnvRules({…}))` (`/env`), `healthRoute` | env.md |
| 2FA, white-label, headers | `twoFactor: { issuer, plugin: payloadTotp }`, `whiteLabel`, `buildSecurityHeaders` | security.md, white-label.md |
| Panel link preview + noindex (site name, description, preview image, technology support credit) | on by default (`adminMeta`, `agency`) — do not hand-write `admin.meta` for it; override single keys in `admin.meta` or `adminMeta: { … }` | white-label.md |
@@ -1241,6 +1241,116 @@ add missing hosts with flags / `extra`; (3) change `mode` to `'enforce'` in both
| Sitemap split / CDN cache / memo | `sitemapOptions: { maxUrls: Infinity, cacheControl: false, memoSeconds: 0 }` | `sitemapEntries`, `createSitemapRouteHandler`, `buildSitemapIndexXml`, `buildSitemapEntries` |
| Sitemap error = 503 + `Retry-After` | — (correct HTTP behaviour) | your own route with `buildSitemapXml` |
| IndexNow silent with `IAPL_NOINDEX` | `indexNow` off by default | `submitToIndexNow` by hand |
| A site with no SMTP server in the panel sends through the Intecion mail service: it enrols by itself on its first send (an outbound call with its host and the plugin version) and gets its own token through the public route `POST /api/iapl/mail-relay/confirm` | `mail: { relay: false }` (no call, no routes, no state block) | `mail.relay: { url, host, enrol, token, senderName, kind, accountMail, confirmRateLimit, timeoutMs, retryBackoffMs, fetchImpl }`; `mailAdapter({ relay })`; §7.2 |
| The mail service's token is kept in `payload.kv` (never in a field, never readable over REST or GraphQL), bound to the site's server addresses, rotated every 90 days | "Disconnect" in the panel; `disconnectRelay` | `enrolRelay`, `rotateRelayToken`, `setRelayToken`, `getRelayStatus` |
| Account e-mails through the mail service: at most 5 to one address and 10 asked for by one visitor an hour | `mail: { relay: { accountMail: false } }` | `accountMail: { perAddress, perVisitor, windowMinutes }` |
| Every message says what it is (form notification, form confirmation, account, test, system) | — (other transports ignore the mark) | `withMailKind`, `runWithMailKind`, `expectMailTo`, `mail.relay.kind`, `buildFormMailKindHook` |
| Microsoft Graph as transport: deprecated, one warning per start, removed in 2.0 | `mail: { graphDeprecationWarning: false }` (the warning only) | move off it: email.md "Moving off Microsoft Graph" |
### 7.2 E-mail — the mail service (default), SMTP (on request), Graph (deprecated)
**What you wire — three lines, every site:**
```ts
// src/payload.config.ts
import { iapl, mailAdapter } from '@intecion/ipal-kit'
export default buildConfig({
serverURL: process.env.NEXT_PUBLIC_SERVER_URL, // the public https address the site answers on, without a redirect
email: mailAdapter(),
plugins: [iapl({ /* … */ })],
})
```
Then `pnpm generate:importmap` (the e-mail tab has a new component, `@intecion/ipal-kit/admin#MailRelayStatus`).
No env variable, no key, no field to fill in. **Do not** add `nodemailer`, `resend`, an `api/send` route or a
`GRAPH_*` variable to a project.
**How a send is routed** (`resolveMailTransport`, type `MailTransport`): Microsoft Graph when the panel says so and
`GRAPH_*` is set (deprecated) → SMTP when server, user name and password are filled in → Graph when `GRAPH_*` is set →
the mail service → nothing (`mail: { relay: false }` and no SMTP). A site with SMTP filled in never contacts the service.
**What the site needs for the mail service** — check each one:
1. `serverURL` is the production host itself (`https://example.com`, not a host that redirects to `www`).
2. `POST https://<host>/api/iapl/mail-relay/confirm` is reachable from the internet with no redirect, no basic
auth, no firewall rule. `trailingSlash: true` in `next.config` or another `routes.api` break it — the fix is
Intecion setting the site's confirm address, not moving the route (email.md "When the site cannot be confirmed").
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`).
**Verify:** Site integrations → E-mail sending → the block "How e-mails are sent" says "Connected to the built-in
mail service"; **Send test e-mail** answers "through the built-in mail service, as <name>"; the mail arrives from
`notification@webservices.intecion.net` with the client's name and `Reply-To` the client's address; `iapl-doctor
--url` reports no `mail-*` finding. On `localhost` the plugin refuses to enrol (nothing leaves the machine): test
mail locally with SMTP (Mailpit) or `createFakeRelay()`.
**The client wants its own mail server:** fill in "Own SMTP server", user name, password and "Sender address" in the
panel, send a test. Nothing in code. **A site on `GRAPH_*`:** keeps working, warns once per start; move it when the
owner says so (email.md "Moving off Microsoft Graph").
**Your own mail** goes through `payload.sendEmail`. Say what it is when it is not a generic system message:
```ts
import { runWithMailKind, withMailKind } from '@intecion/ipal-kit'
await payload.sendEmail(withMailKind({ to: user.email, subject, html }, 'account')) // to an account holder only
await runWithMailKind('account', () => inviteUsers(payload, list))
```
Kinds (`MailKind`, `MAIL_KINDS`, key `MAIL_KIND`, reader `mailKindOf`): `form-notification`, `form-confirmation`
(both set by the plugin on every form e-mail — `buildFormMailKindHook`), `account` (Payload's "forgot password" and
"verify your e-mail": set by the plugin through `expectMailTo`), `test`, `security-alert`, `system` (the default).
A wrong kind gives a visitor more room than the service means to give: `account` only for mail to an account
holder, `form-confirmation` for an address a visitor typed.
**Options** — `iapl({ mail: { relay, graphDeprecationWarning } })` (`MailOptions`, `RelayOptions`; `mailAdapter({ relay })`
overrides per adapter; `resolveRelayOptions` reads what is in effect):
| Key | Default | Meaning |
|---|---|---|
| `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 |
| `enrol` | `'auto'` | `'manual'` (only "Connect again" / `enrolRelay`), `false` (token from `token` / `setRelayToken`) |
| `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 |
| `accountMail` | `{ perAddress: 5, perVisitor: 10, windowMinutes: 60 }` | the site's own limit on account mail; `false` = none |
| `confirmRateLimit` | `{ max: 10, windowMs: 60000 }` | the public confirm route, per address |
| `timeoutMs`, `retryBackoffMs`, `fetchImpl` | 30 s, 1 s, `fetch` | one attempt; wait between attempts; tests |
| `graphDeprecationWarning` | `true` | `false` = no start warning on a Graph site (`GRAPH_DEPRECATION_NOTICE`) |
**Routes the plugin adds** (gone with `relay: false`): `POST /api/iapl/mail-relay/confirm` — public, `404` unless
the site itself just started an enrolment, rate-limited; allow it in any WAF or proxy rule. Admin only:
`GET /api/iapl/mail-relay/status` (`?refresh=1`), `POST …/connect` (optionally `{ token }`), `POST …/disconnect`.
**Failures** are recorded in `emailStatus` with a code (`RELAY_STATUS_CODES`, `RelayStatusCode`, `relayStatusFor`):
`relay-pending`, `relay-suspended`, `relay-refused`, `relay-disconnected`, `relay-quota`, `relay-too-large`,
`relay-attachment-refused`, `relay-recipient-suppressed`, `relay-unreachable`, `relay-not-confirmed`, `relay-error`
(and the warning `relay-name-replaced`) — what each means and what to do: `iapl-debug`, "E-mail". A send returns
`RelaySendResult`; `confirmed: false` means the message **may** have been sent — do not send it again under
another content; the same message sent again reuses its key and cannot double.
**Limits** (the service's; per site): 30 messages an hour, 200 a day, 10 recipients a message, 10 MB of files —
read from the service (`mailAttachmentLimit`, `relayAttachmentLimit`), never typed into a project. A site that
needs more: Intecion raises the limits, or SMTP.
**Building blocks** (root entry; all optional — the three lines above are enough):
| Need | Use |
|---|---|
| The transport alone, no SMTP / Graph | `email: relayAdapter()` (`RelayAdapterArgs`) |
| Enrol from a deploy script; state; rotate; disconnect; a token issued by hand | `enrolRelay` (`EnrolResult`), `getRelayStatus` (`RelayStatus`), `rotateRelayToken`, `disconnectRelay`, `setRelayToken` |
| Your own state block or panel route | `mailPanelState` (`MailPanelState`), `relayPanelEndpoints`, `relayConfirmEndpoint`; the plugin's component is `MailRelayStatus` (`/admin`) |
| One message with the retry rule; one HTTP call | `sendThroughRelay` (`RelaySendContext`, `RelaySendResult`), `relayRequest` (`RelayCall`, `RelayAnswer`, `RelayRefusal`) |
| The request the service takes | `buildRelayMessage` (`BuildRelayMessageArgs`, `BuiltRelayMessage`, `RelaySendRequest`), `bareAddress`, `bareAddresses`, `cleanSubject` |
| 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` |
**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`.
---
@@ -1407,7 +1517,7 @@ Anything that needs a developer → move it to the panel.
| Cookie consent, banner | [consent.md](../consent.md) |
| Cookie scanner (review list, Open Cookie Database) | [cookie-scanner.md](../cookie-scanner.md) |
| Routing, archives, redirects, Markdown, search | [content.md](../content.md) |
| Email SMTP / Graph | [email.md](../email.md) |
| E-mail: the mail service (default), SMTP, Graph (deprecated) | [email.md](../email.md) |
| Env validation | [env.md](../env.md) |
| Forms, useForm, honeypot | [forms.md](../forms.md) |
| Hooks | [hooks.md](../hooks.md) |
@@ -1449,7 +1559,7 @@ file points to them.
# AGENTS.md
**Project:** <client> · <domain> · market <PL/AU/US> · industry <…>
**Languages:** <pl, en, de> · **Media:** <R2 / local> · **Email:** <SMTP / Graph>
**Languages:** <pl, en, de> · **Media:** <R2 / local> · **Email:** <mail service / own SMTP>
## Rules
Before your first change, read all of:
+18 -1
View File
@@ -97,7 +97,24 @@ through this procedure. Ask only when you are missing something you cannot get y
|---|---|---|
| pixel before consent (consent-check) | script wired by hand (`<Script>`) | only through the panel → `<Analytics>` (GA/GTM/pixels) or `<ConsentScript>` (analytics.md, consent.md) |
| banner without styles | Tailwind does not scan the plugin | `@source` on `node_modules/@intecion/ipal-kit/dist/**/*.js` (path relative to the CSS file, PROGRAMISTA §2.5) |
| emails are not sent | no `email: mailAdapter()` / empty transport / empty Emails tab | email.md; Send test in the panel |
| emails are not sent | no `email: mailAdapter()` / empty Emails tab of the form / the transport fails | Site integrations → E-mail sending: read the block "How e-mails are sent" and the banner's code, then **Send test e-mail**; rows below; email.md |
| 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-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 |
| `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 |
| `relay-too-large` / `relay-attachment-refused` | files over the service's limit (10 MB a message); a program or script as attachment | lower the File field's maximum (`iapl-form`); other file types; SMTP for larger files |
| `relay-recipient-suppressed` | one recipient's mailbox bounced or complained before (for any site); nothing was sent to anybody | correct the address in the form's Emails tab; ask Intecion to clear the address |
| `relay-unreachable` | the service or its mail back end failed, or the server cannot reach `webservices.intecion.net` | `curl -s https://webservices.intecion.net/mail/health` from the server → `{"ok":true}`; if it persists: SMTP, and tell Intecion |
| `relay-not-confirmed` / "may have been sent" | no answer from the service (time-out, connection lost) | check the recipient's mailbox **before** sending again; the same message sent again cannot double |
| `relay-error` | the service refused the request as wrong (a bug), or the message has no valid recipient or no body | server log line `[iapl] mail service: …` → `iapl-plugin-gap` |
| the mail arrives under the site's host instead of the client's name | the service did not accept "Sender name" (an address, a bank or provider name, mixed scripts, over 64 characters) — the state block says which name was used | another name; an honest name that is still replaced → Intecion |
| replies to the site's mail are lost | "Sender address" is empty: the service's own address has no mailbox | fill it in (doctor: `mail-reply-address`) |
| the site enrols again and again (`reverify` in the log) | requests leave from many changing addresses (serverless, a pool of egress addresses) | Intecion raises the site's limit of server addresses, or SMTP |
| start log: "Microsoft Graph as the e-mail transport is deprecated" | `GRAPH_*` is set | email.md "Moving off Microsoft Graph"; silence only: `mail: { graphDeprecationWarning: false }` |
| the e-mail tab shows a blank where "How e-mails are sent" should be | stale import map | `pnpm payload generate:importmap`, commit, redeploy |
| old email sender | mail client cache | check the raw headers |
| form: `unknown_fields` | field outside the definition (honeypot not removed) | `iapl-form` → actions.ts |
| an account logs in to `/admin` and sees "Unauthorized" (its API calls still work) | `accounts.panelRole`: the panel opens for `editor` and above; the account has only `user`, or no role | give it `editor` (an admin edits the account), or `accounts: { panelRole: 'user' }`; nobody can get in: a script with the Local API sets `roles: ['admin']`, or `accounts: { panelRole: false }` + redeploy |
+4
View File
@@ -21,6 +21,10 @@ Full reference: `node_modules/@intecion/ipal-kit/docs/doctor.md`.
```
2. Show the user the **full output**. Every finding names its rule, the file, a fix and a doc.
3. Fix every `error`. A `warning` is drift — fix it or tell the user why not. `info` is a note.
E-mail findings (`--deep`): `mail-transport` (nothing set up, or sending fails), `mail-relay-state` (the site's state
with the Intecion mail service: waiting for approval, stopped, refused, disconnected, a replaced sender name),
`mail-reply-address`, `mail-graph-deprecated`, `mail-relay-route` (trailing slashes, another API route, a redirect or a
block in front of `/api/iapl/mail-relay/confirm`) — fixes: `iapl-debug` "Consent / analytics / forms / email".
4. A deliberate exception (the owner's decision) goes into `iapl-doctor.json` **with a reason** — the same reason as in
AGENTS.md "Project decisions". Never silence a rule just to make the run pass:
```json
+2
View File
@@ -109,6 +109,8 @@ Never build this by hand (your own `<input type="file">`, upload route or upload
the visitor that the problem is the **file**, why, and what to do (a smaller file, another format; on an
optional field also "send the form without the file"). They show at the File field; what the visitor typed stays.
6. Mail size: **Site integrations → E-mail sending → Test e-mail** with **Attach a 10 MB test file** must arrive.
The mail service (the default transport): 10 MB for all files of one message unless Intecion set another number
for the site — the form's limit follows what the service reports by itself, and programs and scripts are refused.
SMTP: the provider's limit decides (a 10 MB server limit carries only ~7 MB of file — lower the field's
maximum). Microsoft Graph: files of 3 MB and more need the `Mail.ReadWrite` permission on the agency app
(email.md "Attachments"); without it they go over SMTP when the panel has SMTP settings, else the form's limit
+19 -8
View File
@@ -43,7 +43,8 @@ Before I set up the site I need your decisions on:
1. Languages: which ones, which is the default, URLs — every language with a prefix (/pl/…, /en/…) or the default without one?
2. Styling: a design system / DESIGN.md, or Tailwind tokens from scratch? Brand colours, fonts, light/dark theme?
3. Pages and content: which pages? Lists with their own URLs (blog, case studies, products) and their archive pages?
4. Forms: which forms, who receives the submissions, e-mail via SMTP (panel) or Microsoft Graph?
4. Forms: which forms, who receives the submissions? E-mail works through the built-in Intecion mail service with no
setup — does the client want its **own SMTP server and sender address** instead? (Never offer Microsoft Graph: deprecated.)
5. Analytics and consent: GA4 / GTM / Meta / other pixels? Consent Mode basic or advanced? Cookie dialog
inline / modal / detailed? Cookie scan of the finished site?
6. SEO/GEO: market, local business (address, opening hours)? AI access (llms.txt, Markdown, MCP, AI bots) — on?
@@ -199,8 +200,9 @@ export default buildConfig({
`.env.example` (no values, in the repo): `DATABASE_URI`, `PAYLOAD_SECRET`, `NEXT_PUBLIC_SERVER_URL`, `R2_BUCKET`,
`R2_ENDPOINT`, `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY`, `R2_PUBLIC_URL` (empty = media through the app — the default), `IAPL_IP_HEADER` (`cf-connecting-ip`
behind Cloudflare, `x-forwarded-for` behind a plain proxy), `IAPL_NOINDEX` (empty; `1` on staging only), `INDEXNOW_KEY`,
`NEXT_PUBLIC_TURNSTILE_SITE_KEY`, `TURNSTILE_SECRET_KEY` (deprecated fallback — production keys go into the panel), with Graph `GRAPH_TENANT_ID`,
`GRAPH_CLIENT_ID`, `GRAPH_CLIENT_SECRET`, `GRAPH_SENDER`. Local `.env` with `PAYLOAD_SECRET` ≥ 32 characters (in production `iaplEnvRules` refuses a shorter one; `secretMinLength` changes it).
`NEXT_PUBLIC_TURNSTILE_SITE_KEY`, `TURNSTILE_SECRET_KEY` (deprecated fallback — production keys go into the panel). **No variable for mail**: the
mail service needs none, SMTP is typed in the panel, and `GRAPH_TENANT_ID` / `GRAPH_CLIENT_ID` / `GRAPH_CLIENT_SECRET` / `GRAPH_SENDER` (Microsoft Graph, deprecated, removed in 2.0)
are never added to a new site. Local `.env` with `PAYLOAD_SECRET` ≥ 32 characters (in production `iaplEnvRules` refuses a shorter one; `secretMinLength` changes it).
One language: one entry in `locales`, no `[locale]` folder (i18n.md).
**Check.** `pnpm payload generate:importmap` (whiteLabel adds admin components) and `pnpm generate:types` without
@@ -295,7 +297,10 @@ the panel shows Site settings, Site integrations, Cookies, Form messages, the Fo
preview image (`/api/ipal/admin-og`) from Site settings; `agency` names who supports the technology (default
Intecion.com). Turn off: `adminMeta: false`, `agency: false`; your own `admin.meta` keys win. Check:
`curl -s localhost:3000/admin/login | grep -E 'og:|robots'` → `noindex, nofollow`, `og:site_name` = Site settings name.
- Mail: any Payload adapter instead of `mailAdapter()`; `mailAdapter({ fallbackFromAddress, smtp, graph })`.
- Mail: the Intecion mail service is the default transport (AGENT.md §7.2, email.md). Off: `iapl({ mail: { relay: false } })`
(SMTP only, no outbound call, no `/api/iapl/mail-relay/*` routes). Override: `mail: { relay: { host, enrol, token, senderName,
kind, accountMail, url } }`, `mailAdapter({ fallbackFromAddress, relay, smtp })`; the transport alone: `relayAdapter()`; any
Payload adapter instead of `mailAdapter()`. `serverURL` must be the public address — the service calls the site back there.
- R2: other storage-s3 options (prefix, clientUploads) → call `s3Storage` yourself instead of `buildR2Storage`.
- `forms: { adminGroup, fields, formOverrides, formSubmissionOverrides, beforeEmail, emailLayout }` (forms.md).
- `adminRoute: '/its'` — requires moving `app/(payload)/admin` → `its`, a proxy matcher with `its` (stage 6)
@@ -572,8 +577,10 @@ every language, consent checkbox). Cookies: skill **iapl-consent-check** — `co
Cookies → Cookie list; on the cookie policy page a block with `<CookieTable>` (`/rsc`, data from `getCookieTable`);
the same list appears in the `settings="detailed"` dialog (labels: Cookies → Settings window → Cookie list headings, every language).
**Check.** Panel → Forms: the seeded form; a submission on `/pl` → an entry in Form Submissions + 2 emails (SMTP:
Site integrations → E-mail sending → Send test); with Turnstile test keys the widget is visible, without a token the submission is rejected;
**Check.** Panel → Forms: the seeded form; a submission on `/pl` → an entry in Form Submissions + 2 emails. Mail on a
development machine: the mail service does not enrol a site on `localhost` (the state block says so; nothing leaves the
machine) — fill in a local SMTP catcher (Mailpit: server `127.0.0.1`, port `1025`, any user name and password) in Site
integrations → E-mail sending and use **Send test e-mail**; on the deployed domain empty the SMTP fields again; with Turnstile test keys the widget is visible, without a token the submission is rejected;
`node .agents/skills/iapl-consent-check/scripts/consent-check.mjs http://localhost:3000/pl` = 0 errors;
after a choice in the banner a new record in Consent records.
@@ -637,7 +644,11 @@ scaling (5). `●` routes for pages need the database at build time (PROGRAMISTA
5. **Cookies**: banner texts, Privacy link label, Policy version, Cookies (import from the scan), Detail labels —
in every language.
6. **Notifications**: form messages in every language.
7. **Site integrations**: SMTP or Graph (From Name/Address; Send test), Turnstile (for testing site
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 the built-in mail
service" ("waiting for approval" = ask Intecion to approve the host), then **Send test e-mail** → "through the built-in
mail service". 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.
@@ -645,7 +656,7 @@ scaling (5). `●` routes for pages need the database at build time (PROGRAMISTA
**Deployment (Coolify — the only path; the user/team does it, you prepare the inputs).** Full procedure:
`node_modules/@intecion/ipal-kit/docs/deployment.md` §4. Hand over:
- the env list for the Coolify app, each marked **build time** and/or **runtime** — `NEXT_PUBLIC_*` both; secrets
(`PAYLOAD_SECRET`, `R2_*`, `GRAPH_*`, `TURNSTILE_SECRET_KEY`, `IAPL_IP_HEADER`) runtime; `DATABASE_URI` /
(`PAYLOAD_SECRET`, `R2_*`, `TURNSTILE_SECRET_KEY`, `IAPL_IP_HEADER`) runtime; `DATABASE_URI` /
`PAYLOAD_SECRET` also build time when pages are prerendered from the database (§3a3);
- domains `https://client.pl,https://www.client.pl` with the www ↔ apex redirect matching `NEXT_PUBLIC_SERVER_URL`;
port 3000; health check `/api/health`;
+31 -2
View File
@@ -535,8 +535,8 @@ Every name from before keeps working: `ipalKit()` and the other old exports, the
`ipal-doctor.json`, `ipal-audit-skip`, the old pointer block. The package is still `@intecion/ipal-kit`; routes
`/api/ipal/*`, `--ipal-*` tokens, `data-ipal` hooks and the cookie `ipal_vid` are unchanged (AGENT.md "Names: IAPL and
ipal-kit"). **Do not rename anything in the project unless the owner asks.**
1. Update the package, `pnpm install`. No option, schema, migration or import-map change (`pnpm payload generate:importmap`
gives no diff).
1. Update the package, `pnpm install`. The rename itself changes no option, schema, migration or import map; the mail
service of the same release adds one admin component — see the next block.
2. Refresh the skills: `pnpm exec iapl-skills` (the project's `ipal:skills` script, where it has one, runs the same program). It
installs `iapl-*`, removes the 16 old `ipal-*` folders by name (a skill of the project's own named `ipal-…` stays),
and rewrites the pointer block in `AGENTS.md` in place. Commit the result. Old skill names written by hand in
@@ -552,6 +552,35 @@ ipal-kit"). **Do not rename anything in the project unless the owner asks.**
**Check:** `pnpm exec iapl-doctor` shows no new error or warning (new rules: `legacy-names`, `storage-names`); the site
builds; the panel opens; the old commands (`pnpm exec ipal-doctor`) still run.
**→ 1.17.0, e-mail (the Intecion mail service is the default transport; Microsoft Graph deprecated; CHANGELOG 1.17.0;
PROGRAMISTA §6, item 73; email.md; AGENT.md §7.2) — one command for every site, then read which case the site is:**
1. **Every site:** `pnpm payload generate:importmap` and commit — the e-mail tab has a new component
(`@intecion/ipal-kit/admin#MailRelayStatus`); with a stale map the block "How e-mails are sent" is blank. No schema
change, no migration.
2. **Which case** — Site integrations → E-mail sending, and the Coolify env:
- **SMTP filled in** (server, user name, password): nothing changes, the site contacts nobody. Done.
- **`GRAPH_*` set:** mail as before; one deprecation warning per start, doctor warning `mail-graph-deprecated`.
Do **not** remove the variables in passing — moving the site is the owner's decision (email.md "Moving off
Microsoft Graph"). Note: with `GRAPH_*` set and SMTP filled in, the panel's choice decides as before.
- **Neither** (mail failed with "not configured" until now): **on its next e-mail the site contacts
`webservices.intecion.net` with its host and the plugin version**, receives its own token through the new public
route `POST /api/iapl/mail-relay/confirm`, and from then on sends from `[email protected]`
under the panel's "Sender name". Agree it with the owner **before** the deploy; to keep the old behaviour:
`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.
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
"forgot password" are marked by the plugin.
**Check:** `pnpm exec iapl-doctor --deep --url <site>` → no `mail-transport` / `mail-relay-state` / `mail-reply-address` /
`mail-relay-route` finding (or only `mail-graph-deprecated` on a Graph site); Site integrations → E-mail sending →
**Send test e-mail** names the transport you expect; a form submission arrives. **The service has to be live for a site
without SMTP: until Intecion says so, such a site reports `relay-unreachable` and sends nothing — keep SMTP, or
`relay: false`.**
## 2. Inventory (no code changes)
**What changed for projects** between your old and new plugin version is exactly the reference site's diff —
`git diff v<old> v<new> -- reference/` in the IAPL repo (or the two `docs/agent/reference-site/INDEX.md` files):