Index: test_email.py =================================================================== --- test_email.py (revision 84142) +++ test_email.py (working copy) @@ -2546,6 +2546,44 @@ eq(msg['message-id'], 'spam') eq(msg.get_payload(), "Here's the message body\n") + def test_longheader_continuation(self): + eq = self.assertEqual + # This message contains a line after the Subject: header that has only + # whitespace, but it is not empty! + msg = email.message_from_string("""\ +From: aperson@dom.ain +To: bperson@dom.ain +Subject: RE: [issue51] Mails being delayed [assignedto=stuartm;priority=me +dium] +\x20 +Date: Mon, 8 Apr 2002 15:09:19 -0400 +Message-ID: spam + +Here's the message body +""") + eq(msg['subject'], 'the next line has a space on it\n ') + eq(msg['message-id'], 'spam') + eq(msg.get_payload(), "Here's the message body\n") + + def test_longheader_continuation_last_header(self): + eq = self.assertEqual + # Like the previous test, but the subject line is the last + # header. + msg = email.message_from_string("""\ +From: aperson@dom.ain +To: bperson@dom.ain +Date: Mon, 8 Apr 2002 15:09:19 -0400 +Message-ID: spam +Subject: RE: [issue51] Mails being delayed [assignedto=stuartm;priority=me +dium] +\x20 + +Here's the message body +""") + eq(msg['subject'], 'RE: [issue51] Mails being delayed [assignedto=stuartm;priority=medium]') + eq(msg['message-id'], 'spam') + eq(msg.get_payload(), "Here's the message body\n") + def test_crlf_separation(self): eq = self.assertEqual with openfile('msg_26.txt', newline='\n') as fp: