Update email.py
This commit is contained in:
parent
7140950e93
commit
90524356fc
1 changed files with 4 additions and 2 deletions
|
|
@ -51,9 +51,11 @@ def chunk(
|
||||||
attachment_res = []
|
attachment_res = []
|
||||||
|
|
||||||
if binary:
|
if binary:
|
||||||
msg = BytesParser(policy=policy.default).parse(io.BytesIO(binary))
|
with io.BytesIO(binary) as buffer:
|
||||||
|
msg = BytesParser(policy=policy.default).parse(buffer)
|
||||||
else:
|
else:
|
||||||
msg = BytesParser(policy=policy.default).parse(open(filename, "rb"))
|
with open(filename, "rb") as buffer:
|
||||||
|
msg = BytesParser(policy=policy.default).parse(buffer)
|
||||||
|
|
||||||
text_txt, html_txt = [], []
|
text_txt, html_txt = [], []
|
||||||
# get the email header info
|
# get the email header info
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue