]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/alerts: Generate Message-Id for mails sent by alerts module
authorLorenz Bausch <info@lorenzbausch.de>
Tue, 8 Mar 2022 13:36:20 +0000 (14:36 +0100)
committerBoris Ranto <branto@redhat.com>
Wed, 18 May 2022 05:57:23 +0000 (07:57 +0200)
Signed-off-by: Lorenz Bausch <info@lorenzbausch.de>
(cherry picked from commit ef5975e701cfeb58f2dd8fb9f0410d08692fa757)

src/pybind/mgr/alerts/module.py

index 296bcf9381da714a686478cc2c52979ea2563129..5031b39a7ad7537f3ef3e4c3f4c7f6b1514ce6f2 100644 (file)
@@ -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')