From 69de0dd86f282f47bb24082c773b3a78a6796b51 Mon Sep 17 00:00:00 2001 From: etgocode Date: Sat, 8 Aug 2026 00:54:44 +0200 Subject: [PATCH] removed empty entries in `to_emails` removed empty entries in `to_emails` caused i.e. by the input `,` as pointed out in https://github.com/netalertx/NetAlertX/pull/1732#discussion_r3738840647 Also added an abort if no entries remain in `to_emails` after this step. --- front/plugins/_publisher_email/email_smtp.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/front/plugins/_publisher_email/email_smtp.py b/front/plugins/_publisher_email/email_smtp.py index 5e1a3280..1700ed98 100755 --- a/front/plugins/_publisher_email/email_smtp.py +++ b/front/plugins/_publisher_email/email_smtp.py @@ -118,6 +118,14 @@ def send(pHTML, pText): to_emails = get_setting_value("SMTP_REPORT_TO").split(',') else: to_emails.append(get_setting_value("SMTP_REPORT_TO")) + + # remove empty array entries + to_emails = [x for x in to_emails if x] + + # throw error if array empty + if not to_emails: + mylog('none', [f'[Email Check Config] ⚠ ERROR: Email service not set up correctly. Check your {confFileName} SMTP_REPORT_TO variable.']) + return False subject, from_email, emails, message_html, message_text = sanitize_email_content( str(get_setting_value("SMTP_SUBJECT")),