Commit bfe90528 authored by Florian Apolloner's avatar Florian Apolloner
Browse files

Decode mails using the message encoding.

parent c988745c
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -15,10 +15,12 @@ class EmailBackend(BaseEmailBackend):
        super(EmailBackend, self).__init__(*args, **kwargs)

    def write_message(self, message):
        msg = message.message().as_bytes()
        msg = message.message()
        msg_data = msg.as_bytes()
        if six.PY3:
            msg = msg.decode()
        self.stream.write('%s\n' % msg)
            charset = msg.get_charset().get_output_charset() if msg.get_charset() else 'utf-8'
            msg_data = msg_data.decode(charset)
        self.stream.write('%s\n' % msg_data)
        self.stream.write('-' * 79)
        self.stream.write('\n')