Read contents, metadata and attachments from Outlook Message files
Project description
outlook_msg
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for outlook_msg-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf13847e55f2b9e7f75717f8764d878775ed6f154edf65504586bec6f72b2372 |
|
MD5 | 085aa3c9ec33b36c3599831fee0f50b8 |
|
BLAKE2b-256 | 08e539e3da92cc657880f68357b6b9da0f374058271866d4dc4795b0a15d70e2 |