From 4d17b205052c72d5a5199bf76a4da205946c7f39 Mon Sep 17 00:00:00 2001 From: Lorenz Bausch Date: Tue, 8 Mar 2022 14:45:03 +0100 Subject: [PATCH] mgr/alerts: Add Date header to mails sent by alerts module Signed-off-by: Lorenz Bausch (cherry picked from commit 4031917739c1e17d909a3fd53fb74fd0fc86030a) --- src/pybind/mgr/alerts/module.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/alerts/module.py b/src/pybind/mgr/alerts/module.py index 5031b39a7ad..f20f047162d 100644 --- a/src/pybind/mgr/alerts/module.py +++ b/src/pybind/mgr/alerts/module.py @@ -4,7 +4,7 @@ A simple cluster health alerting module. """ from mgr_module import CLIReadCommand, HandleCommandResult, MgrModule, Option -from email.utils import make_msgid +from email.utils import formatdate, make_msgid from threading import Event from typing import Any, Optional, Dict, List, TYPE_CHECKING, Union import json @@ -205,13 +205,15 @@ class Alerts(MgrModule): 'Subject: {status}\n' 'To: {target}\n' 'Message-Id: {message_id}\n' + 'Date: {date}\n' '\n' '{status}\n'.format( sender=self.smtp_sender, from_name=self.smtp_from_name, status=status['status'], target=self.smtp_destination, - message_id=make_msgid())) + message_id=make_msgid(), + date=formatdate())) if 'new' in diff: message += ('\n--- New ---\n') -- 2.47.3