Docs in English (part 1), seeding guide, Coolify deployment
- Translate to English every doc the code branches did not touch: AGENT.md, developer guide, vibe, CHANGELOG, docs index, module pages, all skills except ipal-seo-check (14 pages follow after the security/SEO merge). Placeholder marker is now [TO FILL: …]; skill resources renamed to section-code.md / nav-code.md. AGENT.md and the ipal-skills pointer block say the docs are in English. - docs/seeding.md: create-only, natural keys, never delete, no users or secrets, empty-field globals, fallbackLocale: false, dry run, backup and restore, production update guard, seeds vs migrations, Coolify Terminal. Seed templates gain --dry-run, the SEED_UPDATE production guard (IPAL_SEED_ALLOW_PROD_UPDATE), skip of edited records and a summary. "Seeding on production" rule block in AGENT.md. - Coolify is the single deployment path (deployment, env, developer guide, ipal-setup): build vs runtime env, migrations on container start (prodMigrations), health check and rolling updates, rollback, backups and restore, DNS/Let's Encrypt/CAA. R2: custom domain needs a Cloudflare zone; default is media served by the app (R2_PUBLIC_URL empty). - docsConsistency: no Polish prose outside code/quoted data (pending pages listed); IPAL_* names may also be read by shipped skill templates. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
6e3979bae6
commit
2d9f3e15d4
+136
-136
@@ -1,24 +1,24 @@
|
||||
# email
|
||||
|
||||
Wysyłka maili z dwoma transportami do wyboru: **SMTP z panelu**
|
||||
(`panelSmtpAdapter`, uniwersalny) albo **Microsoft Graph** (`graphAdapter`,
|
||||
przez Exchange/M365). Oba implementują ten sam interfejs `PayloadEmailAdapter`,
|
||||
więc `payload.sendEmail` i maile z formularzy działają niezależnie od wyboru.
|
||||
Projekt wpina adapter w `buildConfig({ email })` (zalecany dyspozytor `mailAdapter()`),
|
||||
a edytor wybiera transport w panelu. Osobny helper `sendEmail` (z `/server`) wysyła
|
||||
**zawsze przez SMTP** z panelu, z pominięciem adaptera.
|
||||
Sending mail with two transports to choose from: **SMTP from the panel**
|
||||
(`panelSmtpAdapter`, universal) or **Microsoft Graph** (`graphAdapter`,
|
||||
through Exchange/M365). Both implement the same `PayloadEmailAdapter` interface,
|
||||
so `payload.sendEmail` and form mail work whatever the choice.
|
||||
The project wires the adapter in `buildConfig({ email })` (the recommended dispatcher is `mailAdapter()`),
|
||||
and the editor picks the transport in the panel. A separate `sendEmail` helper (from `/server`) sends
|
||||
**always through the SMTP** from the panel, bypassing the adapter.
|
||||
|
||||
## Zależność
|
||||
## Dependency
|
||||
|
||||
`nodemailer` (`^8`) jest już w `dependencies` pluginu — projekt nie musi go
|
||||
instalować. Graph to czysty `fetch`, bez dodatkowych pakietów.
|
||||
`nodemailer` (`^8`) is already in the plugin's `dependencies` — the project does not need to
|
||||
install it. Graph is plain `fetch`, no extra packages.
|
||||
|
||||
## Config
|
||||
|
||||
Brak opcji pluginu — SMTP (`smtpHost`, `smtpPort` (domyślnie 587), `smtpUser`,
|
||||
`smtpPassword`, `smtpFromAddress`, `smtpFromName`) oraz `emailTransport` są w
|
||||
SiteIntegrations (tab SMTP). Edytor konfiguruje w panelu. Plugin **nie** ustawia
|
||||
`config.email` — adapter wpinasz sam (niżej).
|
||||
No plugin options — SMTP (`smtpHost`, `smtpPort` (default 587), `smtpUser`,
|
||||
`smtpPassword`, `smtpFromAddress`, `smtpFromName`) and `emailTransport` live in
|
||||
SiteIntegrations (SMTP tab). The editor configures them in the panel. The plugin does **not** set
|
||||
`config.email` — you wire the adapter yourself (below).
|
||||
|
||||
## Front — sendEmail (server)
|
||||
|
||||
@@ -29,43 +29,43 @@ const result = await sendEmail({
|
||||
payload,
|
||||
to: '[email protected]',
|
||||
subject: 'Nowa wiadomość',
|
||||
html: '<h1>Cześć</h1><p>Treść…</p>', // gotowy HTML (Twój wygląd)
|
||||
// text: 'wersja plain', from: '...', replyTo: '...'
|
||||
html: '<h1>Cześć</h1><p>Treść…</p>', // finished HTML (your design)
|
||||
// text: 'plain version', from: '...', replyTo: '...'
|
||||
})
|
||||
|
||||
if (result.sent) {
|
||||
// result.messageId
|
||||
} else {
|
||||
// result.error — np. "SMTP is not configured..."
|
||||
// result.error — e.g. "SMTP is not configured..."
|
||||
}
|
||||
```
|
||||
|
||||
- Zawsze SMTP z panelu (nie Graph, nie `mailAdapter`); bez `smtpHost`/`smtpUser`/`smtpPassword`
|
||||
- Always the SMTP from the panel (not Graph, not `mailAdapter`); without `smtpHost`/`smtpUser`/`smtpPassword`
|
||||
→ `{ sent: false, error: 'SMTP is not configured in Site Integrations.' }`.
|
||||
- `from` nadpisuje adres (nazwa nadal z `smtpFromName`); bez `from` i bez
|
||||
- `from` overrides the address (the name still comes from `smtpFromName`); without `from` and without
|
||||
`smtpFromAddress` → `{ sent: false, error: 'No from-address configured.' }`.
|
||||
- **HTML to Twój argument** — plugin nie ma templatek, wysyła to co podasz.
|
||||
Wygląd maila składasz na froncie.
|
||||
- Zwraca `{ sent: true, messageId }` albo `{ sent: false, error }` — nie
|
||||
rzuca wyjątku, nie wycieka detali SMTP do klienta (błąd SMTP → ogólne
|
||||
`'Failed to send email.'`, szczegóły w logu).
|
||||
- Port 465 → implicit TLS, inne → STARTTLS.
|
||||
- `server-only` — hasło SMTP nigdy w bundlu przeglądarki.
|
||||
- **The HTML is your argument** — the plugin has no templates, it sends what you pass.
|
||||
You build the mail's look in the frontend.
|
||||
- Returns `{ sent: true, messageId }` or `{ sent: false, error }` — it does not
|
||||
throw and does not leak SMTP details to the client (SMTP error → generic
|
||||
`'Failed to send email.'`, details in the log).
|
||||
- Port 465 → implicit TLS, others → STARTTLS.
|
||||
- `server-only` — the SMTP password never ends up in the browser bundle.
|
||||
|
||||
## Uwaga: maile systemowe Payloada
|
||||
## Note: Payload system mail
|
||||
|
||||
Reset hasła / weryfikacja email idą przez wbudowany mechanizm Payload
|
||||
(`config.email`), którego plugin sam **nie** ustawia. Wystarczy wpiąć
|
||||
`mailAdapter()` / `panelSmtpAdapter()` w `buildConfig({ email })` (niżej) — wtedy
|
||||
te maile też idą przez skrzynkę z panelu, bez SMTP w env.
|
||||
Password reset / email verification go through Payload's built-in mechanism
|
||||
(`config.email`), which the plugin does **not** set by itself. Wire
|
||||
`mailAdapter()` / `panelSmtpAdapter()` in `buildConfig({ email })` (below) — then
|
||||
this mail also goes through the mailbox from the panel, with no SMTP in env.
|
||||
|
||||
## Adapter — SMTP z panelu dla całego Payloada
|
||||
## Adapter — SMTP from the panel for all of Payload
|
||||
|
||||
`sendEmail` wysyła własnym transportem. Osobno plugin daje adapter, który
|
||||
podłącza tę samą skrzynkę pod `payload.sendEmail`:
|
||||
`sendEmail` sends with its own transport. Separately, the plugin provides an adapter that
|
||||
connects the same mailbox to `payload.sendEmail`:
|
||||
|
||||
Zalecany jest `mailAdapter()` (niżej, „Wpięcie — wybór transportu”) — zawiera ten
|
||||
adapter i dokłada Graph. Sam SMTP:
|
||||
`mailAdapter()` is recommended (below, "Wiring — choosing the transport") — it contains this
|
||||
adapter and adds Graph. SMTP only:
|
||||
|
||||
```ts
|
||||
// payload.config.ts
|
||||
@@ -73,172 +73,172 @@ import { panelSmtpAdapter } from '@intecion/ipal-kit'
|
||||
|
||||
export default buildConfig({
|
||||
email: panelSmtpAdapter(),
|
||||
// panelSmtpAdapter({ fallbackFromAddress, fallbackFromName }) — używane tylko
|
||||
// zanim panel zostanie wypełniony (Payload wymaga adresu synchronicznie przy
|
||||
// starcie, zanim można odczytać globala)
|
||||
// panelSmtpAdapter({ fallbackFromAddress, fallbackFromName }) — used only
|
||||
// before the panel is filled in (Payload needs the address synchronously at
|
||||
// startup, before the global can be read)
|
||||
})
|
||||
```
|
||||
|
||||
Opcje: `fallbackFromAddress` (`'noreply@localhost'`), `fallbackFromName` (`'Website'`).
|
||||
Adres i nazwa z panelu zawsze wygrywają nad `from` wiadomości. Temat ma usuwane
|
||||
znaki CR/LF (ochrona przed wstrzyknięciem nagłówków przez `{{pole}}` form-buildera).
|
||||
Brak konfiguracji SMTP albo błąd wysyłki → adapter **nie rzuca**, zwraca
|
||||
`{ sent: false, error }` i loguje.
|
||||
Options: `fallbackFromAddress` (`'noreply@localhost'`), `fallbackFromName` (`'Website'`).
|
||||
The address and name from the panel always win over the message's `from`. CR/LF characters are
|
||||
stripped from the subject (protection against header injection through form-builder `{{field}}`).
|
||||
Missing SMTP config or a send error → the adapter **does not throw**, it returns
|
||||
`{ sent: false, error }` and logs.
|
||||
|
||||
Po wpięciu wszystko, co w Payloadzie wysyła maile, idzie przez SMTP z Site
|
||||
Integrations — w tym wbudowane maile form-buildera (Forms → Emails), maile
|
||||
resetu hasła i weryfikacji konta. Adapter czyta konfigurację przy każdym
|
||||
wysłaniu, więc zmiana skrzynki w panelu działa bez restartu.
|
||||
Once wired, everything in Payload that sends mail goes through the SMTP from Site
|
||||
Integrations — including the built-in form-builder mail (Forms → Emails), password
|
||||
reset and account verification mail. The adapter reads the config on every
|
||||
send, so changing the mailbox in the panel works without a restart.
|
||||
|
||||
Bez adaptera Payload używa mocka, który tylko loguje do konsoli — maile
|
||||
form-buildera nie wyjdą.
|
||||
Without an adapter Payload uses a mock that only logs to the console — form-builder
|
||||
mail will not go out.
|
||||
|
||||
## Maskowanie sekretów w panelu (MaskedField)
|
||||
## Masking secrets in the panel (MaskedField)
|
||||
|
||||
Wrażliwe pola w Site Integrations (`smtpPassword`, `turnstileSecretKey`) są
|
||||
maskowane w UI — pokazują `••••` zamiast plaintextu, z
|
||||
przyciskiem Reveal/Hide. To maskowanie UI, NIE hashowanie ani szyfrowanie:
|
||||
wartość w bazie jest plaintext (musi być odzyskiwalna do autentykacji SMTP / Turnstile).
|
||||
Chroni przed patrzeniem przez ramię i przypadkowym pokazaniem panelu.
|
||||
Sensitive fields in Site Integrations (`smtpPassword`, `turnstileSecretKey`) are
|
||||
masked in the UI — they show `••••` instead of plaintext, with
|
||||
a Reveal/Hide button. This is UI masking, NOT hashing or encryption:
|
||||
the value in the database is plaintext (it must be recoverable for SMTP / Turnstile authentication).
|
||||
It protects against shoulder-surfing and showing the panel by accident.
|
||||
|
||||
Podpięte przez `admin.components.Field: '@intecion/ipal-kit/admin#MaskedField'`.
|
||||
Działa na dowolnym polu `text`. Po wpięciu w projekcie może być konieczne
|
||||
`payload generate:importmap`, żeby panel rozpoznał komponent.
|
||||
Wired through `admin.components.Field: '@intecion/ipal-kit/admin#MaskedField'`.
|
||||
Works on any `text` field. After wiring it in a project you may need
|
||||
`payload generate:importmap` so the panel recognizes the component.
|
||||
|
||||
> Główną ochroną sekretów pozostaje `read: isAdmin` na globalu SiteIntegrations
|
||||
> (anonim nie dostaje). Maskowanie to warstwa dodatkowa (shoulder-surfing), nie
|
||||
> ochrona bazy — przy wycieku DB sekrety są czytelne.
|
||||
> The main protection of secrets remains `read: isAdmin` on the SiteIntegrations global
|
||||
> (anonymous users do not get it). Masking is an extra layer (shoulder-surfing), not
|
||||
> database protection — if the DB leaks, the secrets are readable.
|
||||
|
||||
|
||||
## Adapter — Microsoft Graph (Exchange / M365)
|
||||
|
||||
Alternatywa dla SMTP: wysyłka przez Microsoft Graph API, przez skrzynkę w
|
||||
Waszym (agencyjnym) tenancie M365. Wszystkie maile z formularzy wszystkich
|
||||
projektów idą przez JEDNĄ skrzynkę nadawczą (np. `[email protected]`).
|
||||
Alternative to SMTP: sending through the Microsoft Graph API, through a mailbox in
|
||||
your (agency) M365 tenant. All form mail from all
|
||||
projects goes through ONE sender mailbox (e.g. `[email protected]`).
|
||||
|
||||
### Podział konfiguracji (celowy)
|
||||
### Config split (deliberate)
|
||||
|
||||
**Sekrety w `.env`** (agencyjne — Wasz Exchange, klient nie widzi):
|
||||
**Secrets in `.env`** (agency-level — your Exchange, the client does not see it):
|
||||
|
||||
```bash
|
||||
GRAPH_TENANT_ID=...
|
||||
GRAPH_CLIENT_ID=...
|
||||
GRAPH_CLIENT_SECRET=...
|
||||
GRAPH_SENDER=[email protected] # jedna skrzynka dla wszystkich projektów
|
||||
GRAPH_SENDER=[email protected] # one mailbox for all projects
|
||||
```
|
||||
|
||||
**Z panelu** (per projekt) czyta istniejące pola SMTP — bez nowych pól:
|
||||
- `smtpFromName` → nazwa wyświetlana nadawcy; **adres From to zawsze `GRAPH_SENDER`**
|
||||
(brak nazwy → pole `from` pominięte, Graph używa domyślnej nazwy skrzynki),
|
||||
- `smtpFromAddress` → **Reply-To** (chyba że wiadomość ma własne `replyTo`).
|
||||
**From the panel** (per project) it reads the existing SMTP fields — no new fields:
|
||||
- `smtpFromName` → sender display name; **the From address is always `GRAPH_SENDER`**
|
||||
(no name → the `from` field is omitted, Graph uses the mailbox's default name),
|
||||
- `smtpFromAddress` → **Reply-To** (unless the message has its own `replyTo`).
|
||||
|
||||
Opcje `graphAdapter({ fallbackFromAddress, fallbackFromName })` — tylko placeholdery
|
||||
wymagane przez Payload przy starcie.
|
||||
Options `graphAdapter({ fallbackFromAddress, fallbackFromName })` — only placeholders
|
||||
Payload requires at startup.
|
||||
|
||||
### Wpięcie — wybór transportu (zalecane: `mailAdapter`)
|
||||
### Wiring — choosing the transport (recommended: `mailAdapter`)
|
||||
|
||||
```ts
|
||||
// payload.config.ts
|
||||
import { mailAdapter } from '@intecion/ipal-kit'
|
||||
|
||||
email: mailAdapter(), // SMTP albo Graph — wybór w panelu, przy KAŻDEJ wysyłce
|
||||
email: mailAdapter(), // SMTP or Graph — chosen in the panel, on EVERY send
|
||||
```
|
||||
|
||||
`mailAdapter` to dyspozytor: czyta `emailTransport` z Site Integrations przy każdej
|
||||
wysyłce (brak wartości → `'smtp'`), więc przełącznik w panelu działa bez restartu.
|
||||
Graph tylko gdy wszystkie 4 zmienne `GRAPH_*` są w env — inaczej czytelny log i
|
||||
fallback na SMTP (mail nie ginie po cichu).
|
||||
`mailAdapter` is a dispatcher: it reads `emailTransport` from Site Integrations on every
|
||||
send (no value → `'smtp'`), so the switch in the panel works without a restart.
|
||||
Graph only when all 4 `GRAPH_*` variables are in env — otherwise a clear log and
|
||||
fallback to SMTP (mail is not lost silently).
|
||||
|
||||
Opcje: `fallbackFromAddress`, `fallbackFromName` (do obu delegatów), `smtp`
|
||||
Options: `fallbackFromAddress`, `fallbackFromName` (for both delegates), `smtp`
|
||||
(`PanelSmtpAdapterArgs`), `graph` (`GraphAdapterArgs`).
|
||||
|
||||
Niskopoziomowo (gdy transport ma być zaszyty w configu):
|
||||
Low-level (when the transport should be fixed in the config):
|
||||
|
||||
```ts
|
||||
import { panelSmtpAdapter, graphAdapter } from '@intecion/ipal-kit'
|
||||
email: process.env.GRAPH_CLIENT_ID ? graphAdapter() : panelSmtpAdapter()
|
||||
```
|
||||
|
||||
### Setup Azure / Exchange (jednorazowo, Wasza strona, POZA kodem)
|
||||
### Azure / Exchange setup (one-time, your side, OUTSIDE the code)
|
||||
|
||||
1. **App registration** w Azure AD → `tenantId`, `clientId`
|
||||
1. **App registration** in Azure AD → `tenantId`, `clientId`
|
||||
2. **Client secret** → `clientSecret`
|
||||
3. **API Permissions** → Microsoft Graph → **Application** → `Mail.Send` →
|
||||
**Grant admin consent** (bez tego: `Insufficient privileges`)
|
||||
4. **Exchange Admin Center** → skrzynka `[email protected]` → Mailbox
|
||||
Delegation → aplikacja do **"Send As"** (bez tego: `ErrorAccessDenied`)
|
||||
**Grant admin consent** (without it: `Insufficient privileges`)
|
||||
4. **Exchange Admin Center** → mailbox `[email protected]` → Mailbox
|
||||
Delegation → the app gets **"Send As"** (without it: `ErrorAccessDenied`)
|
||||
|
||||
### Szczegóły techniczne
|
||||
### Technical details
|
||||
|
||||
- Auth: client credentials flow, scope `https://graph.microsoft.com/.default`
|
||||
(NIE `Mail.Send` — Azure odrzuca, AADSTS1002012)
|
||||
- Wysyłka: `POST /users/{sender}/sendMail` (NIE `/me` — app-only nie ma „me")
|
||||
- Sukces: HTTP 202 (pusty body)
|
||||
- Czysty REST (fetch), zero bibliotek Microsoft, zero nowych zależności
|
||||
(NOT `Mail.Send` — Azure rejects it, AADSTS1002012)
|
||||
- Sending: `POST /users/{sender}/sendMail` (NOT `/me` — app-only has no "me")
|
||||
- Success: HTTP 202 (empty body)
|
||||
- Plain REST (fetch), zero Microsoft libraries, zero new dependencies
|
||||
|
||||
### From vs Send-As
|
||||
|
||||
Adapter **nie** wysyła z adresu z panelu — From ma zawsze adres `GRAPH_SENDER`
|
||||
(zmienia się tylko nazwa wyświetlana), a `smtpFromAddress` z panelu trafia do
|
||||
Reply-To. Exchange nie wymaga więc Send-As na cudze domeny; odpowiedzi trafiają
|
||||
na adres klienta. Token OAuth jest pobierany przy każdej wysyłce (bez cache),
|
||||
The adapter does **not** send from the address in the panel — From is always the `GRAPH_SENDER` address
|
||||
(only the display name changes), and `smtpFromAddress` from the panel goes into
|
||||
Reply-To. So Exchange does not need Send-As on other domains; replies go
|
||||
to the client's address. The OAuth token is fetched on every send (no cache),
|
||||
`saveToSentItems: false`.
|
||||
|
||||
## Przełącznik transportu — mailAdapter
|
||||
## Transport switch — mailAdapter
|
||||
|
||||
`mailAdapter()` to dyspozytor: jeden adapter wpięty w config, wybiera transport
|
||||
(SMTP/Graph) przy KAŻDEJ wysyłce, czytając ustawienie z panelu. Dzięki temu
|
||||
przełącznik działa w panelu (Payload buduje adapter raz przy starcie, więc nie
|
||||
da się podmieniać osobnych adapterów w runtime — dyspozytor deleguje wewnątrz).
|
||||
`mailAdapter()` is a dispatcher: one adapter wired in the config, it picks the transport
|
||||
(SMTP/Graph) on EVERY send by reading the setting from the panel. That is why
|
||||
the switch works in the panel (Payload builds the adapter once at startup, so you cannot
|
||||
swap separate adapters at runtime — the dispatcher delegates internally).
|
||||
|
||||
```ts
|
||||
// payload.config.ts — JEDEN adapter, wybór wewnątrz
|
||||
// payload.config.ts — ONE adapter, the choice happens inside
|
||||
import { mailAdapter } from '@intecion/ipal-kit'
|
||||
email: mailAdapter()
|
||||
```
|
||||
|
||||
Panel → Site Integrations → SMTP → **Email Transport** (SMTP / Microsoft Graph).
|
||||
Dyspozytor czyta ten wybór per wysyłka. Guard: jeśli wybrano Graph, ale brak
|
||||
sekretów w .env → log + fallback na SMTP (nie cicha awaria).
|
||||
The dispatcher reads this choice per send. Guard: if Graph is selected but the
|
||||
secrets are missing in .env → log + fallback to SMTP (no silent failure).
|
||||
|
||||
## Test wysyłki — przycisk w panelu
|
||||
## Test send — button in the panel
|
||||
|
||||
W tabie SMTP jest przycisk **Send test**: podaj adres, kliknij, wyślij testowy
|
||||
mail przez AKTUALNY transport (`payload.sendEmail`). Pokazuje wynik (✓/✗ z błędem). Endpoint
|
||||
`POST /api/ipal/test-email`, body `{ to }` (tylko rola `admin` — wymaga ról z opcji `access`:
|
||||
niezalogowany → 401, inna rola → 403, zły adres → 400, nieudana wysyłka → 502).
|
||||
Zapisz zmiany przed testem — endpoint czyta z bazy, nie z pola na ekranie.
|
||||
The SMTP tab has a **Send test** button: enter an address, click, and a test
|
||||
mail goes out through the CURRENT transport (`payload.sendEmail`). It shows the result (✓/✗ with the error). Endpoint
|
||||
`POST /api/ipal/test-email`, body `{ to }` (`admin` role only — needs roles from the `access` option:
|
||||
not logged in → 401, other role → 403, bad address → 400, failed send → 502).
|
||||
Save your changes before the test — the endpoint reads from the database, not from the field on screen.
|
||||
|
||||
> Przycisk pokazuje tylko krótki błąd adaptera (np. `Graph sendMail failed (403).`,
|
||||
> `Failed to send email.`, `SMTP is not configured…`). Pełna odpowiedź Graph / SMTP
|
||||
> (`ErrorSendAsDenied`, `Insufficient privileges`, `535 …`) jest w **logach serwera**;
|
||||
> dla SMTP szczegół trafia też do banera statusu (niżej).
|
||||
> The button shows only the adapter's short error (e.g. `Graph sendMail failed (403).`,
|
||||
> `Failed to send email.`, `SMTP is not configured…`). The full Graph / SMTP response
|
||||
> (`ErrorSendAsDenied`, `Insufficient privileges`, `535 …`) is in the **server logs**;
|
||||
> for SMTP the detail also goes to the status banner (below).
|
||||
|
||||
## Status wysyłki w panelu
|
||||
## Send status in the panel
|
||||
|
||||
`mailAdapter()` zapisuje wynik wysyłek w Site Integrations (najwyżej raz na 10 min
|
||||
przy trwającym błędzie, od razu przy zmianie stanu). Gdy wysyłka się nie udaje:
|
||||
- **Dashboard** — czerwony alert z przyczyną i linkiem do Site Integrations,
|
||||
- **Site Integrations → SMTP** — baner z błędem (np. `SMTP: connect ECONNREFUSED …`,
|
||||
`mailAdapter()` stores the send result in Site Integrations (at most once per 10 min
|
||||
while an error persists, immediately when the state changes). When sending fails:
|
||||
- **Dashboard** — a red alert with the cause and a link to Site Integrations,
|
||||
- **Site Integrations → SMTP** — a banner with the error (e.g. `SMTP: connect ECONNREFUSED …`,
|
||||
`SMTP: SMTP is not configured…`, `SMTP: Invalid login: 535 …`,
|
||||
`Microsoft Graph: Graph sendMail failed (403).`) i czasem.
|
||||
`Microsoft Graph: Graph sendMail failed (403).`) and the time.
|
||||
|
||||
Status zapisuje tylko `mailAdapter` — sam `panelSmtpAdapter` / `graphAdapter` i
|
||||
helper `sendEmail` go nie aktualizują.
|
||||
Only `mailAdapter` stores the status — `panelSmtpAdapter` / `graphAdapter` alone and
|
||||
the `sendEmail` helper do not update it.
|
||||
|
||||
Formularz przy tym **działa dalej** — zgłoszenie jest zapisane w Form Submissions,
|
||||
tylko mail nie wyszedł. Graph wybrany w panelu bez `GRAPH_*` w env → ostrzeżenie
|
||||
„sent over SMTP”. Zmiana pól SMTP / transportu w panelu czyści status; po kolejnej
|
||||
wysyłce (np. **Send test**) pojawi się aktualny.
|
||||
The form **keeps working** meanwhile — the submission is saved in Form Submissions,
|
||||
only the mail did not go out. Graph selected in the panel without `GRAPH_*` in env → warning
|
||||
"sent over SMTP". Changing the SMTP / transport fields in the panel clears the status; after the next
|
||||
send (e.g. **Send test**) the current one appears.
|
||||
|
||||
## Wyłączenie, nadpisanie, rozszerzenie
|
||||
## Turn off, override, extend
|
||||
|
||||
- **Wyłączenie:** plugin sam nie ustawia `config.email` — bez `email:` w `buildConfig` Payload używa
|
||||
swojego mocka (maile tylko w konsoli). Pola SMTP w Site Integrations i endpoint
|
||||
`POST /api/ipal/test-email` są obecnie zawsze dodawane.
|
||||
- **Wybór transportu:** `mailAdapter()` (panel decyduje) albo na sztywno `panelSmtpAdapter()` /
|
||||
`graphAdapter()`; dowolny inny adapter Payloada (np. `@payloadcms/email-nodemailer`) też działa —
|
||||
wtedy pomijasz panelowy SMTP i status wysyłek.
|
||||
- **Nadpisanie:** `fallbackFromAddress` / `fallbackFromName`, w `mailAdapter` osobno `smtp` i `graph`.
|
||||
- **Rozszerzenie:** treść maili formularzy modyfikuje `forms.beforeEmail` (patrz [forms.md](./forms.md));
|
||||
własne maile — `sendEmail` (SMTP) albo `payload.sendEmail` (przez wpięty adapter).
|
||||
- **Turn off:** the plugin does not set `config.email` itself — without `email:` in `buildConfig` Payload uses
|
||||
its mock (mail only in the console). The SMTP fields in Site Integrations and the endpoint
|
||||
`POST /api/ipal/test-email` are currently always added.
|
||||
- **Choosing the transport:** `mailAdapter()` (the panel decides) or a fixed `panelSmtpAdapter()` /
|
||||
`graphAdapter()`; any other Payload adapter (e.g. `@payloadcms/email-nodemailer`) also works —
|
||||
then you skip the panel SMTP and the send status.
|
||||
- **Override:** `fallbackFromAddress` / `fallbackFromName`, in `mailAdapter` separately `smtp` and `graph`.
|
||||
- **Extend:** form mail content is modified by `forms.beforeEmail` (see [forms.md](./forms.md));
|
||||
your own mail — `sendEmail` (SMTP) or `payload.sendEmail` (through the wired adapter).
|
||||
|
||||
Reference in New Issue
Block a user