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:
2026-11-08 20:51:41 +01:00
co-authored by Claude Sonnet 5.5
parent 142815a3ab
commit bd9790819d
12 changed files with 308 additions and 40 deletions
@@ -14,13 +14,13 @@ namespace SlpModularCms.Core.Hosting;
public class SystemController : ControllerBase
{
private readonly ModuleOrchestrator _orchestrator;
private readonly IOptions<EmailOptions> _email;
private readonly IMailAvailability _mail;
private readonly IOptions<AppMailOptions> _app;
public SystemController(ModuleOrchestrator orchestrator, IOptions<EmailOptions> email, IOptions<AppMailOptions> app)
public SystemController(ModuleOrchestrator orchestrator, IMailAvailability mail, IOptions<AppMailOptions> app)
{
_orchestrator = orchestrator;
_email = email;
_mail = mail;
_app = app;
}
@@ -32,7 +32,7 @@ public class SystemController : ControllerBase
return Ok(new
{
Modules = _orchestrator.ModuleNames,
EmailEnabled = !string.IsNullOrWhiteSpace(_email.Value.Smtp.Host),
EmailEnabled = _mail.IsEnabled,
DefaultLanguage = MailLanguages.Normalize(_app.Value.DefaultLanguage) ?? MailLanguages.Dutch
});
}