#1079037 Use local time instead of GMT for Date header

#1079037#5
Date:
2024-08-19 08:20:20 UTC
From:
To:
Hi,

when sending mail with the mailer module the Date: header will contain
the current timestamp based on UTC/GMT.  Currently this results in a
difference of two hours in Germany, which confuses those who are not
parsing the timezone component (+0000 versus +0200).

It seems to me that it would be more useful and user-friendly if the
module would use the local time and timezone instead of UTC.

If you agree please consider using the following patch to accomplish
this:

Index: python-mailer-0.8.1/mailer.py
===================================================================
--- python-mailer-0.8.1.orig/mailer.py
+++ python-mailer-0.8.1/mailer.py
@@ -218,7 +218,7 @@ class Message(object):
         self.Subject    = params.get('subject', '') # string
         self.Body       = params.get('body', None)
         self.Html       = params.get('html', None)
-        self.Date       = params.get('date', time.strftime("%a, %d %b %Y %H:%M:%S %z", time.gmtime()))
+        self.Date       = params.get('date', time.strftime("%a, %d %b %Y %H:%M:%S %z", time.localtime()))
         self.charset    = params.get('charset', 'us-ascii')
         self.Headers    = params.get('headers', {})


Regards

	Joey