Откройте все файлы .msg в папке и загрузите вложения. - PullRequest
0 голосов
/ 19 июня 2020

Не могли бы вы помочь мне заставить этот код открыть все файлы .msg в папке и загрузить вложение.

Я использую Outlook_msg

from outlook_msg import Message

with open('PO.msg') as msg_file:
    msg = Message(msg_file)

# Contents are the plaintext body of the email
contents = msg.body

# Attachments can be read and saved like so
first_attachment = msg.attachments[0]
with first_attachment.open() as attachment_fp, open(first_attachment.filename, 'wb') as output_fp:
    output_fp.write(attachment_fp.read())
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...