##// END OF EJS Templates
fixes #481 rhodecode emails are sent without Date header...
marcink -
r2452:d95ef658 beta
parent child Browse files
Show More
@@ -50,6 +50,7 b' fixes'
50 50 - fixed issue #459. Changed the way of obtaining logger in reindex task.
51 51 - fixed #453 added ID field in whoosh SCHEMA that solves the issue of
52 52 reindexing modified files
53 - fixes #481 rhodecode emails are sent without Date header
53 54
54 55 1.3.6 (**2012-05-17**)
55 56 ----------------------
@@ -3,6 +3,7 b' from rhodecode.lib.rcmail.response impor'
3 3 from rhodecode.lib.rcmail.exceptions import BadHeaders
4 4 from rhodecode.lib.rcmail.exceptions import InvalidMessage
5 5
6
6 7 class Attachment(object):
7 8 """
8 9 Encapsulates file attachment information.
@@ -134,13 +135,13 b' class Message(object):'
134 135 """
135 136
136 137 if not self.recipients:
137 raise InvalidMessage, "No recipients have been added"
138 raise InvalidMessage("No recipients have been added")
138 139
139 140 if not self.body and not self.html:
140 raise InvalidMessage, "No body has been set"
141 raise InvalidMessage("No body has been set")
141 142
142 143 if not self.sender:
143 raise InvalidMessage, "No sender address has been set"
144 raise InvalidMessage("No sender address has been set")
144 145
145 146 if self.is_bad_headers():
146 147 raise BadHeaders
@@ -364,6 +364,7 b' def to_message(mail, separator="; "):'
364 364
365 365 return out
366 366
367
367 368 class MIMEPart(MIMEBase):
368 369 """
369 370 A reimplementation of nearly everything in email.mime to be more useful
@@ -387,7 +388,8 b' class MIMEPart(MIMEBase):'
387 388 self.set_payload(encoded, charset=charset)
388 389
389 390 def extract_payload(self, mail):
390 if mail.body == None: return # only None, '' is still ok
391 if mail.body == None:
392 return # only None, '' is still ok
391 393
392 394 ctype, ctype_params = mail.content_encoding['Content-Type']
393 395 cdisp, cdisp_params = mail.content_encoding['Content-Disposition']
@@ -415,7 +417,8 b' class MIMEPart(MIMEBase):'
415 417
416 418
417 419 def header_to_mime_encoding(value, not_email=False, separator=", "):
418 if not value: return ""
420 if not value:
421 return ""
419 422
420 423 encoder = Charset(DEFAULT_ENCODING)
421 424 if type(value) == list:
@@ -424,6 +427,7 b' def header_to_mime_encoding(value, not_e'
424 427 else:
425 428 return properly_encode_header(value, encoder, not_email)
426 429
430
427 431 def properly_encode_header(value, encoder, not_email):
428 432 """
429 433 The only thing special (weird) about this function is that it tries
@@ -21,10 +21,11 b''
21 21 #
22 22 # You should have received a copy of the GNU General Public License
23 23 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24
24 import time
25 25 import logging
26 26 import smtplib
27 27 from socket import sslerror
28 from email.utils import formatdate
28 29 from rhodecode.lib.rcmail.message import Message
29 30
30 31
@@ -59,8 +60,11 b' class SmtpMailer(object):'
59 60
60 61 if isinstance(recipients, basestring):
61 62 recipients = [recipients]
63 headers = {
64 'Date': formatdate(time.time())
65 }
62 66 msg = Message(subject, recipients, body, html, self.mail_from,
63 recipients_separator=", ")
67 recipients_separator=", ", extra_headers=headers)
64 68 raw_msg = msg.to_message()
65 69
66 70 if self.ssl:
General Comments 0
You need to be logged in to leave comments. Login now