1
0
Fork 1
mirror of https://github.com/coddingtonbear/django-mailbox.git synced 2026-07-09 22:38:19 +02:00

Fixed encoding error when saving messages to file (fixes #85)

This commit is contained in:
Justin Standring 2016-03-17 09:44:08 +13:00
parent 7bb816b9ce
commit 7fdfa4bb0f

View file

@ -362,7 +362,7 @@ class Mailbox(models.Model):
def _process_message(self, message): def _process_message(self, message):
msg = Message() msg = Message()
if STORE_ORIGINAL_MESSAGE: if STORE_ORIGINAL_MESSAGE:
msg.eml.save('%s.eml' % uuid.uuid4(), ContentFile(message), save=False) msg.eml.save('%s.eml' % uuid.uuid4(), ContentFile(message.as_string(unixfrom=True)), save=False)
msg.mailbox = self msg.mailbox = self
if 'subject' in message: if 'subject' in message:
msg.subject = convert_header_to_unicode(message['subject'])[0:255] msg.subject = convert_header_to_unicode(message['subject'])[0:255]