Skip to content

Commit 5dfc4a7

Browse files
authored
Added code which adds ItemAttachments
1 parent a44cedd commit 5dfc4a7

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

outlook_owa/1.0.0/src/app.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -464,18 +464,19 @@ def merge(d1, d2):
464464
output_dict["categories"] = email.categories
465465

466466
if upload_email_shuffle:
467-
email_up = [{"filename": "email.msg",
467+
email_up = [{"filename": "email.eml",
468468
"data": email.mime_content}]
469469
email_id = self.set_files(email_up)
470470
output_dict["email_fileid"] = email_id[0]
471471

472472
if upload_attachments_shuffle:
473-
atts_up = [
474-
{"filename": attachment.name, "data": attachment.content}
475-
for attachment in email.attachments
476-
if type(attachment) == FileAttachment
477-
]
478-
473+
for attachment in email.attachments:
474+
if type(attachment) == FileAttachment:
475+
atts_up.append({"filename": attachment.name, "data": attachment.content})
476+
elif type(attachment) == ItemAttachment:
477+
atts_up.append({"filename": attachment.name, "data": attachment.item.mime_content})
478+
else:
479+
continue
479480
atts_ids = self.set_files(atts_up)
480481
output_dict["attachment_uids"] = atts_ids
481482

0 commit comments

Comments
 (0)