From 5aa87774d7c5497faee8470444f95f419dc5b7db Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Mon, 22 Jun 2026 16:41:28 +0200 Subject: [PATCH] fix(email): stay silent when SMTP notifications are disabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The event subscriber is registered unconditionally and only checked the per-event list (smtpEnabledEvents, default login.attempt,cpu.high) — not the smtpEnable master toggle. Login events are always published, so a panel with smtpEnable=false still attempted a send on every login and logged 'email subscriber: send failed: smtp host not configured'. Gate HandleEvent on GetSmtpEnable() so a disabled-SMTP panel does nothing, matching the comment where the subscriber is registered. --- internal/web/service/email/subscriber.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/web/service/email/subscriber.go b/internal/web/service/email/subscriber.go index bb4a319e9..bf8b483fd 100644 --- a/internal/web/service/email/subscriber.go +++ b/internal/web/service/email/subscriber.go @@ -31,6 +31,9 @@ func NewSubscriber(settingService service.SettingService, emailService *EmailSer // HandleEvent is the eventbus subscriber callback. func (s *Subscriber) HandleEvent(e eventbus.Event) { + if on, err := s.settingService.GetSmtpEnable(); err != nil || !on { + return + } if !s.isEventEnabled(e.Type) { return }