From 2906d4f280ade547a6df69e0baa83318cae930b8 Mon Sep 17 00:00:00 2001 From: Lorenz Bausch Date: Tue, 8 Mar 2022 14:36:20 +0100 Subject: [PATCH] mgr/alerts: Generate Message-Id for mails sent by alerts module Signed-off-by: Lorenz Bausch (cherry picked from commit ef5975e701cfeb58f2dd8fb9f0410d08692fa757) --- src/pybind/mgr/alerts/module.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/alerts/module.py b/src/pybind/mgr/alerts/module.py index 296bcf9381da7..5031b39a7ad75 100644 --- a/src/pybind/mgr/alerts/module.py +++ b/src/pybind/mgr/alerts/module.py @@ -4,6 +4,7 @@ A simple cluster health alerting module. """ from mgr_module import CLIReadCommand, HandleCommandResult, MgrModule, Option +from email.utils import make_msgid from threading import Event from typing import Any, Optional, Dict, List, TYPE_CHECKING, Union import json @@ -203,12 +204,14 @@ class Alerts(MgrModule): message = ('From: {from_name} <{sender}>\n' 'Subject: {status}\n' 'To: {target}\n' + 'Message-Id: {message_id}\n' '\n' '{status}\n'.format( sender=self.smtp_sender, from_name=self.smtp_from_name, status=status['status'], - target=self.smtp_destination)) + target=self.smtp_destination, + message_id=make_msgid())) if 'new' in diff: message += ('\n--- New ---\n') -- 2.39.5