https://code.djangoproject.com/attachment/ticket/11212/0001-Ticket-11212-default-to-7bit-email.patch
If you have any tests that attempt to compare the email-message against what you're sending, you'll need to update them too!
+ # Ticket #11212
+ # Shouldn't use quoted printable, should detect it can represent content with 7 bit data
+ msg = EmailMessage('Subject', 'Body with only ASCII characters.', 'bounce@example.com', ['to@example.com'], headers={'From': 'from@example.com'})
+ s = msg.message().as_string()
+ self.assertFalse('Content-Transfer-Encoding: quoted-printable' in s)
+ self.assertTrue('Content-Transfer-Encoding: 7bit' in s)
+
+ # Shouldn't use quoted printable, should detect it can represent content with 8 bit data
+ msg = EmailMessage('Subject', 'Body with latin characters: àáä.', 'bounce@example.com', ['to@example.com'], headers={'From': 'from@example.com'})
+ s = msg.message().as_string()
+ self.assertFalse('Content-Transfer-Encoding: quoted-printable' in s)
+ self.assertTrue('Content-Transfer-Encoding: 8bit' in s)
+
+ msg = EmailMessage('Subject', u'Body with non latin characters: А Б В Г Д Е Ж Ѕ З И І К Л М Н О П.', 'bounce@example.com', ['to@example.com'], headers={'From': 'from@example.com'})
+ s = msg.message().as_string()
+ self.assertFalse('Content-Transfer-Encoding: quoted-printable' in s)
+ self.assertTrue('Content-Transfer-Encoding: 8bit' in s)
How do I manually specify "Content-Transfer-Encoding: quoted-printable" if I use EmailMultiAlternatives ?
ReplyDelete