Halve of foute mailconfiguratie: host start, mail uit, een duidelijke Error-logregel
Eén bron (IMailAvailability) bepaalt of mail aan staat: SMTP-host gezet EN de hele mailconfiguratie geldig. Anders start de host gewoon, gebruikt de Null-verzender, meldt emailEnabled=false en logt eenmalig mail_configuration_invalid met de namen van de ontbrekende of ongeldige instellingen (nooit waarden of geheimen). Getest: halve config, elke soort fout, geen geheim in het log, volledige config werkt als voorheen, geen mailinstelling geeft geen enkele waarschuwing, alle verbruikers zien mail als uit. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -51,6 +51,6 @@ Read-only checks done from the developer PC (by "CMS & API"): `mail.andreaslop.n
|
||||
|
||||
## Release notes for the host manager (required environment variables per release)
|
||||
- **This release adds NO required environment variable.** A host without any mail setting starts exactly as before; this is tested for every deployed host configuration (master, slave, SlpSoftware, ASF).
|
||||
- Mail is switched on only by setting `Email__Smtp__Host`. **Once a host is set, all of these must be set too, or the host refuses to start** (502 behind the proxy) with a message naming the missing setting: `App__PublicBaseUrl` (https, no path), `Email__FromAddress`/`Email__FromName` (have committed defaults), and `Email__Smtp__Username` together with `Email__Smtp__Password`. Set `App__PublicBaseUrl` BEFORE or together with `Email__Smtp__Host`.
|
||||
- Mail is switched on only by setting `Email__Smtp__Host`, and it only turns ON when the whole mail configuration is valid: `App__PublicBaseUrl` (https, no path), `Email__FromAddress`/`Email__FromName` (committed defaults), `Email__Smtp__Username` together with `Email__Smtp__Password`, and sane port, timeout, colour and logo values. **A half-finished or wrong mail configuration never stops the host from starting** (decided by Bryan after the 2026-11-08 incident): the host starts with mail OFF (`emailEnabled=false`, all mail UI hidden, the copy-link flow keeps working) and logs ONE Error line, `mail_configuration_invalid`, that names each missing or invalid setting (names only, never values or secrets; Sentry sees it). Check the log after changing mail settings. Set `App__PublicBaseUrl` together with `Email__Smtp__Host`.
|
||||
- Optional: `Identity__Invitation__ExpiryHours` (24), `Identity__PasswordReset__TokenLifetimeMinutes` (60), `Identity__PasswordReset__CooldownMinutes` (5), `App__DefaultLanguage` (nl), `Email__AllowedFromAddresses__0..n`, `Website__LogLevel`.
|
||||
- Incident 2026-11-08: ASF test returned 502 after a restart because `Email__Smtp__Host` was set but `App__PublicBaseUrl` was not (start-up validation, by design: a half-configured mail setup is refused rather than silently ignored). Not a deploy without mail configuration. A softer behaviour (start with mail switched off and an error log) is a possible change, see the open question to Bryan.
|
||||
- Incident 2026-11-08: ASF test returned 502 after a restart because `Email__Smtp__Host` was set but `App__PublicBaseUrl` was not (the start-up validation at that time refused a half-configured mail setup). Not a deploy without mail configuration. Since changed: the soft behaviour above.
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
## 3. Functional requirements
|
||||
- **FR-01 Sender abstraction.** `IEmailSender.SendAsync(toAddress, subject, htmlBody, cancellationToken)` in Core; `SmtpEmailSender` (MailKit/MimeKit; StartTls when `EnableSsl`; authenticate only when a username is set). `EmailOptions` (section `Email`): `FromAddress`, `FromName`, `Smtp{Host, Port=587, EnableSsl=true, Username, Password}`, plus a connect/send timeout (new, default 10 s).
|
||||
- **FR-02 Enabled by configuration.** Mail is enabled when `Email:Smtp:Host` is non-empty. When disabled, every flow behaves exactly as today. `GET` system capabilities exposes `emailEnabled` so the UI knows which actions to offer.
|
||||
- **FR-03 Start-up validation.** When enabled: valid `FromAddress`, a host, a port in range, and an absolute https (or localhost) `App:PublicBaseUrl` without a path; otherwise start-up fails with a clear message (no secrets in it).
|
||||
- **FR-03 Start-up validation (changed by Bryan, 2026-11-08: soft).** When an SMTP host is set: valid `FromAddress`/`FromName`, a port in range, credentials as a pair, and an absolute https (or localhost) `App:PublicBaseUrl` without a path. If anything is missing or invalid the host STILL starts, mail stays OFF (`emailEnabled=false`) and one Error log line names each setting (names only, no values, no secrets).
|
||||
- **FR-04 Invitation mail.** Creating an invitation sends a mail with the link `PublicBaseUrl + /admin + /invite/complete?token=...`. The response still returns `inviteLink` and now also `mail: { sent: true|false, error?: <short code> }`. A failure never rolls back the invitation.
|
||||
- **FR-05 New link mail.** The "create new invite link" action (existing) also sends the mail when enabled, with the same result object.
|
||||
- **FR-06 Resend.** Admin action "Mail opnieuw versturen" for a pending invitation: resends the mail with the current valid link; if the invitation is expired it first regenerates it (new token, new lifetime), then sends. Same hierarchy rules as the other invitation actions (Administrator only for role User).
|
||||
|
||||
Reference in New Issue
Block a user