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 = []
|
parts = []
|
||||||
attachments = []
|
attachments = []
|
||||||
|
plain_text_content: 'no plain-text part'
|
||||||
for part in raw_msg.walk():
|
for part in raw_msg.walk():
|
||||||
if part.is_multipart():
|
if part.is_multipart():
|
||||||
continue
|
continue
|
||||||
|
@ -90,7 +91,7 @@ class Mailbox(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
if part.get_content_type() == "text/plain":
|
if part.get_content_type() == "text/plain":
|
||||||
msg.plain_text_content = content
|
plain_text_content = content
|
||||||
|
|
||||||
return Email(
|
return Email(
|
||||||
id=num,
|
id=num,
|
||||||
|
@ -100,7 +101,8 @@ class Mailbox(object):
|
||||||
to_addr=raw_msg["To"],
|
to_addr=raw_msg["To"],
|
||||||
subject=email_nonascii_to_uft8(raw_msg["Subject"]),
|
subject=email_nonascii_to_uft8(raw_msg["Subject"]),
|
||||||
parts=parts,
|
parts=parts,
|
||||||
attachments=attachments
|
attachments=attachments,
|
||||||
|
plain_text_content = plain_text_content
|
||||||
)
|
)
|
||||||
|
|
||||||
def delete_message(self, num):
|
def delete_message(self, num):
|
||||||
|
|
|
@ -26,4 +26,4 @@ class Email(NamedTuple):
|
||||||
subject: str
|
subject: str
|
||||||
parts: List[Part]
|
parts: List[Part]
|
||||||
attachments: List[Attachment]
|
attachments: List[Attachment]
|
||||||
plain_text_content: str = 'no plain-text part'
|
plain_text_content: str
|
||||||
|
|
Loading…
Add table
Reference in a new issue