|
1 | 1 | """Sending Roundup-specific mail over SMTP. |
2 | 2 | """ |
3 | 3 | __docformat__ = 'restructuredtext' |
4 | | -# $Id: mailer.py,v 1.10 2004-07-25 15:25:44 a1s Exp $ |
| 4 | +# $Id: mailer.py,v 1.11 2006-01-13 02:38:45 richard Exp $ |
5 | 5 |
|
6 | 6 | import time, quopri, os, socket, smtplib, re |
7 | 7 |
|
|
11 | 11 | from roundup.rfc2822 import encode_header |
12 | 12 | from roundup import __version__ |
13 | 13 |
|
| 14 | +try: |
| 15 | + from email.Utils import formatdate |
| 16 | +except ImportError: |
| 17 | + def formatdate(timeval): |
| 18 | + return time.strftime("%a, %d %b %Y %H:%M:%S +0000", timeval) |
| 19 | + |
14 | 20 | class MessageSendError(RuntimeError): |
15 | 21 | pass |
16 | 22 |
|
@@ -54,8 +60,7 @@ def get_standard_message(self, to, subject, author=None): |
54 | 60 | writer.addheader('Subject', encode_header(subject, charset)) |
55 | 61 | writer.addheader('To', ', '.join(to)) |
56 | 62 | writer.addheader('From', author) |
57 | | - writer.addheader('Date', time.strftime("%a, %d %b %Y %H:%M:%S +0000", |
58 | | - time.gmtime())) |
| 63 | + writer.addheader('Date', formatdate(time.gmtime())) |
59 | 64 |
|
60 | 65 | # Add a unique Roundup header to help filtering |
61 | 66 | writer.addheader('X-Roundup-Name', encode_header(tracker_name, |
|
0 commit comments