init commit for iPAL-kit plugin
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
# email
|
||||
|
||||
Wysyłka maili przez SMTP z SiteIntegrations, w runtime (bez Payload email
|
||||
adaptera). Edytor zmienia SMTP w panelu — następny mail idzie z nowymi
|
||||
ustawieniami, bez restartu.
|
||||
|
||||
## Zależność
|
||||
|
||||
```json
|
||||
"dependencies": { "nodemailer": "^6.9.0" }
|
||||
```
|
||||
(+ `@types/nodemailer` w devDependencies)
|
||||
|
||||
## Config
|
||||
|
||||
Brak opcji — SMTP (host, port, user, password, from) jest w SiteIntegrations
|
||||
(tab SMTP). Edytor konfiguruje w panelu.
|
||||
|
||||
## Front — sendEmail (server)
|
||||
|
||||
```ts
|
||||
import { sendEmail } from 'ipal-kit/server'
|
||||
|
||||
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: '...'
|
||||
})
|
||||
|
||||
if (result.sent) {
|
||||
// result.messageId
|
||||
} else {
|
||||
// result.error — np. "SMTP is not 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.
|
||||
- Port 465 → implicit TLS, inne → STARTTLS.
|
||||
- `server-only` — hasło SMTP nigdy w bundlu przeglądarki.
|
||||
|
||||
## Uwaga: maile systemowe Payloada
|
||||
|
||||
Reset hasła / weryfikacja email idą przez wbudowany mechanizm Payload
|
||||
(`config.email`), którego ten moduł **nie** konfiguruje (celowo — wymagałby
|
||||
SMTP w env). Jeśli ich potrzebujesz, to osobna konfiguracja adaptera przy
|
||||
`buildConfig`.
|
||||
Reference in New Issue
Block a user