fix encoding

This commit is contained in:
quenousimporte 2024-04-10 17:38:31 +02:00
parent 65e8d98646
commit f1fc5a24c1
1 changed files with 1 additions and 2 deletions

View File

@ -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()