fix plain text part content
This commit is contained in:
parent
ea7585f078
commit
21ab9c7e8b
2 changed files with 5 additions and 3 deletions
|
@ -50,6 +50,7 @@ class Mailbox(object):
|
|||
|
||||
parts = []
|
||||
attachments = []
|
||||
plain_text_content: 'no plain-text part'
|
||||
for part in raw_msg.walk():
|
||||
if part.is_multipart():
|
||||
continue
|
||||
|
@ -90,7 +91,7 @@ class Mailbox(object):
|
|||
)
|
||||
|
||||
if part.get_content_type() == "text/plain":
|
||||
msg.plain_text_content = content
|
||||
plain_text_content = content
|
||||
|
||||
return Email(
|
||||
id=num,
|
||||
|
@ -100,7 +101,8 @@ class Mailbox(object):
|
|||
to_addr=raw_msg["To"],
|
||||
subject=email_nonascii_to_uft8(raw_msg["Subject"]),
|
||||
parts=parts,
|
||||
attachments=attachments
|
||||
attachments=attachments,
|
||||
plain_text_content = plain_text_content
|
||||
)
|
||||
|
||||
def delete_message(self, num):
|
||||
|
|
|
@ -26,4 +26,4 @@ class Email(NamedTuple):
|
|||
subject: str
|
||||
parts: List[Part]
|
||||
attachments: List[Attachment]
|
||||
plain_text_content: str = 'no plain-text part'
|
||||
plain_text_content: str
|
||||
|
|
Loading…
Add table
Reference in a new issue