GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • python-oxmsg
  • Message
  • Attachment
  • Recipient
  • Properties

This view

  • Original page
  • New address

GeezerVison is showing scanny.github.io — python-oxmsg

python-oxmsg

Extract text and attachments from Outlook MSG (.msg) files.

Install

pip install python-oxmsg

Usage

>>> from oxmsg import Message

>>> msg = Message.load("message.msg")

>>> msg.message_class
'IPM.Note'

>>> msg.attachment_count
1

>>> attachment = msg.attachments[0]
>>> attachment.attached_by_value  # -- attachment bytes only available when True --
True

>>> attachment.file_name
'q1-objectives.pptx'

>>> attachment.mime_type
'application/vnd.openxmlformats-officedocument.presentationml.presentation'

>>> attachment.size
96407

>>> attachment.last_modified.isoformat()
'2023-11-18T16:08:17+00:00'

>>> with open(attachment.file_name, "wb") as f:
...     f.write(attachment.file_bytes)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.