Ticket #9214: 9214-EmailMessage-r9084.diff
File 9214-EmailMessage-r9084.diff, 1.8 KB (added by , 16 years ago) |
---|
-
django/core/mail.py
245 245 else: 246 246 msg.attach(self._create_attachment(*attachment)) 247 247 msg['Subject'] = self.subject 248 msg['From'] = self. from_email248 msg['From'] = self.extra_headers.get('From', self.from_email) 249 249 msg['To'] = ', '.join(self.to) 250 250 msg['Date'] = formatdate() 251 251 msg['Message-ID'] = make_msgid() 252 252 for name, value in self.extra_headers.items(): 253 msg[name] = value 253 if name != 'From': 254 msg[name] = value 254 255 return msg 255 256 256 257 def recipients(self): -
tests/regressiontests/mail/tests.py
52 52 >>> message.as_string() 53 53 'Content-Type: text/plain; charset="utf-8"\nMIME-Version: 1.0\nContent-Transfer-Encoding: quoted-printable\nSubject: Long subject lines that get wrapped should use a space continuation\n character to get expected behaviour in Outlook and Thunderbird\nFrom: from@example.com\nTo: to@example.com\nDate: ...\nMessage-ID: <...>\n\nContent' 54 54 55 # Test override of From header (#9214). 56 57 >>> email = EmailMessage('Subject', 'Content', 'bounce@example.com', ['to@example.com'], headers={'From': 'from@example.com'}) 58 >>> message = email.message() 59 >>> message.as_string() 60 'Content-Type: text/plain; charset="utf-8"\nMIME-Version: 1.0\nContent-Transfer-Encoding: quoted-printable\nSubject: Subject\nFrom: from@example.com\nTo: to@example.com\nDate: ...\nMessage-ID: <...>\n\nContent' 61 55 62 """