From: Lorenz Bausch Date: Tue, 8 Mar 2022 13:45:03 +0000 (+0100) Subject: mgr/alerts: Add Date header to mails sent by alerts module X-Git-Tag: v16.2.11~534^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=473a586f003a81036999e47ecf242187f7aa4ba0;p=ceph.git mgr/alerts: Add Date header to mails sent by alerts module Signed-off-by: Lorenz Bausch (cherry picked from commit 4031917739c1e17d909a3fd53fb74fd0fc86030a) Conflicts: src/pybind/mgr/alerts/module.py: Fixed imports --- diff --git a/src/pybind/mgr/alerts/module.py b/src/pybind/mgr/alerts/module.py index db970d7dbc7..3d299f0d49e 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 MgrModule, HandleCommandResult -from email.utils import make_msgid +from email.utils import formatdate, make_msgid from threading import Event import errno import json @@ -212,13 +212,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')