Skip to main content

Read contents, metadata and attachments from Outlook Message files

Project description

outlook_msg

Build Status

outlook_msg is a Python library by Hamilton Group to process the .msg files that Users can export from Outlook. It is very common for users in organizations that use Outlook to archive data in this format. For example, at Hamilton we see these files store in relation to deals we write. If we want to do automatic processing in a way that feels most natural to end users we need to extract data from these files.

This library is built on top of the excellent compoundfiles library, without which none of this would be possible.

Getting Started

Install using pip:

pip install outlook_msg

Usage

To open an email:

from outlook_msg import Message

with open('file.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())

Running the tests

We use pytest to run our tests but you are best to use tox so you can test on all supported Python versions and will ensure a clean environment.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

outlook_msg-1.0.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

outlook_msg-1.0.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file outlook_msg-1.0.0.tar.gz.

File metadata

  • Download URL: outlook_msg-1.0.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2

File hashes

Hashes for outlook_msg-1.0.0.tar.gz
Algorithm Hash digest
SHA256 482d4f4503e4f15def55f18492796ee43eacdc65c0aac7cbba8afd24947a52d1
MD5 ec8b018f84ad38c4f11c7c644aa284a1
BLAKE2b-256 bddb10e5e3e82cbf6201ba1555543c061c91fa4d84dd96dbc4920c7b4ffe2a8b

See more details on using hashes here.

File details

Details for the file outlook_msg-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: outlook_msg-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2

File hashes

Hashes for outlook_msg-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf13847e55f2b9e7f75717f8764d878775ed6f154edf65504586bec6f72b2372
MD5 085aa3c9ec33b36c3599831fee0f50b8
BLAKE2b-256 08e539e3da92cc657880f68357b6b9da0f374058271866d4dc4795b0a15d70e2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page