From: Lorenz Bausch Date: Tue, 8 Mar 2022 13:36:20 +0000 (+0100) Subject: mgr/alerts: Generate Message-Id for mails sent by alerts module X-Git-Tag: v18.0.0~1167^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ef5975e701cfeb58f2dd8fb9f0410d08692fa757;p=ceph.git mgr/alerts: Generate Message-Id for mails sent by alerts module Signed-off-by: Lorenz Bausch --- diff --git a/src/pybind/mgr/alerts/module.py b/src/pybind/mgr/alerts/module.py index 296bcf9381da..5031b39a7ad7 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')