Fix compatibility with multiline MIME encoded header

This commit is contained in:
nemunaire 2018-04-09 00:20:43 +02:00
parent 4df7393069
commit fd1a397c14

View File

@ -2,6 +2,7 @@
from datetime import datetime from datetime import datetime
import email import email
import email.policy
import os import os
import sys import sys
import stat import stat
@ -128,7 +129,7 @@ running for nemunaire@nemunai.re""")
def readmail(fp): def readmail(fp):
cnt = email.message_from_binary_file(fp) cnt = email.message_from_binary_file(fp, policy=email.policy.default)
frm = cnt.get("From") or "someone" frm = cnt.get("From") or "someone"
subject = cnt.get("Subject") or "your mail" subject = cnt.get("Subject") or "your mail"
ref = cnt.get("Message-ID") or "" ref = cnt.get("Message-ID") or ""