Open 21010 opened 1 year ago
@21010 Hi thank you for the report.
Question: Which version of rpaframework
you are using ?
Question: Is this report actually about RPA.Email.Exchange
library and not about RPA.Email.ImapSmtp
?
My response below is related to the latter.
I tried to replicate the issue with an email containing one .msg file (saved one email from Outlook), one .pdf file and one .png file and all were saved correctly.
My code
EMAIL.authorize()
messages = EMAIL.list_messages('SUBJECT "Testing attachments"')
for m in messages:
attachments = EMAIL.save_attachment(m, "./attachments", overwrite=True)
print(f"Saved attachments: {attachments}")
attachments = EMAIL.save_attachments('SUBJECT "Testing attachments"', "./attachments", overwrite=True)
print(f"Saved attachments: {attachments}")
run output
Saved attachments: ['attachments\\Elennith.pdf', 'attachments\\keywords_in_outline.png', 'attachments\\meili.msg']
Saved attachments: ['attachments\\Elennith.pdf', 'attachments\\keywords_in_outline.png', 'attachments\\meili.msg']
Question: Can you provide more details on these messages ? Was the .msg attachment the only attachment in that specific email ?
Hi! I’m using RPA.Email.ImapSmtp to read email from the mailbox and extract all attached files with save_attachments method. For some reason .msg files are not saved - all other attached files are saved, but the file with the extension .msg is not - I can see an object exists in the message property instead.
Code example:
As a result, the attached .msg file will be omitted and not saved. It's because it's not an instance of the FileAttachment, but ItemAttachment where mime_content (attachment.item.mime_content) should be used not just content (attachment.content).