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:
+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