diff --git a/imap2md/export-imap-notes.py b/imap2md/export-imap-notes.py index 5cd6cbe..8370b7c 100644 --- a/imap2md/export-imap-notes.py +++ b/imap2md/export-imap-notes.py @@ -56,13 +56,12 @@ for i in range(messages, messages-N, -1): content_type = msg.get_content_type() body = msg.get_payload(decode=True).decode() if content_type == "text/plain": - open(filepath, "w").write(body) + open(filepath, "wb").write(body.encode('utf8')) if content_type == "text/html": md = markdownify(body) if md[:4] == 'html': md = md[4:] - open(filepath, "wb").write(md.encode('utf8')) imap.close()