11"""Sending Roundup-specific mail over SMTP.
22"""
33__docformat__ = 'restructuredtext'
4- # $Id: mailer.py,v 1.19 2007-09-02 05:54:46 jpend Exp $
4+ # $Id: mailer.py,v 1.20 2007-09-20 19:42:48 jpend Exp $
55
66import time , quopri , os , socket , smtplib , re , sys , traceback
77
1010
1111from roundup .rfc2822 import encode_header
1212from roundup import __version__
13+ from roundup .date import get_timezone
1314
1415try :
1516 from email .Utils import formatdate
@@ -30,6 +31,11 @@ def __init__(self, config):
3031 self .debug = os .environ .get ('SENDMAILDEBUG' , '' ) \
3132 or config ["MAIL_DEBUG" ]
3233
34+ # set timezone so that things like formatdate(localtime=True)
35+ # use the configured timezone
36+ os .environ ['TZ' ] = get_timezone (self .config .TIMEZONE ).tzname (None )
37+ time .tzset ()
38+
3339 def get_standard_message (self , to , subject , author = None ):
3440 '''Form a standard email message from Roundup.
3541
@@ -60,7 +66,7 @@ def get_standard_message(self, to, subject, author=None):
6066 writer .addheader ('Subject' , encode_header (subject , charset ))
6167 writer .addheader ('To' , ', ' .join (to ))
6268 writer .addheader ('From' , author )
63- writer .addheader ('Date' , formatdate ())
69+ writer .addheader ('Date' , formatdate (localtime = True ))
6470
6571 # Add a unique Roundup header to help filtering
6672 writer .addheader ('X-Roundup-Name' , encode_header (tracker_name ,
0 commit comments