skillfed

extract-msg

Extracts emails and attachments saved in Microsoft Outlook's .msg files

extract-msg v0.56.1 7.2M downloads/30d#1,774 on PyPI852
Copyleft license GPL Active released

What it is and what it does

extract-msg is a Python library and command-line tool that parses Microsoft Outlook .msg files and extracts their structured email data and attachments. It automates retrieval of standard email fields (from, to, cc, date, subject, body) and saves attachments to disk or other formats. The package handles OLE2 file parsing, Outlook's Extended MAPI property encoding, RTF decompression, and character set conversion through its runtime dependencies including olefile, compressed-rtf, RTFDE, ebcdic, beautifulsoup4, tzlocal, and red-black-tree-mod.

You can use it as a standalone CLI tool to batch-process .msg files into organized folder structures, or import it into Python code to programmatically read and transform Outlook messages. It supports output to plain text, HTML, PDF, RTF, raw, and JSON formats, with options to handle embedded messages, hidden attachments, and character set conversion. The package is actively maintained and supports Python 3.8 and above.

Use it for:

  • Batch extract emails and attachments from Outlook .msg files for archival or migration
  • Convert Outlook messages to HTML or PDF for document management or compliance workflows
  • Programmatically parse .msg files in a data pipeline to index email metadata or extract structured content
  • Recover email data from .msg files for forensic analysis or email recovery scenarios
  • Automate attachment extraction from a folder of .msg files with filtering by attachment type or hidden status

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Extracts email metadata (from, to, cc, date, subject, body) and attachments from Microsoft Outlook .msg files, with support for multiple output formats including HTML, PDF, RTF, and JSON.

Yes, if you need to parse Outlook .msg files. The package is actively maintained, has low install friction, and offers both CLI and library interfaces. However, note the GPL copyleft license—verify compatibility with your project's licensing before use in proprietary software.

Install

extract-msg on PyPI

pip

pip install extract-msg

uv

uv add extract-msg

poetry

poetry add extract-msg

Installing extract-msg

Before you install

Low install friction with a pure-wheel distribution. Actively maintained with a recent release and 852 repository stars. Requires Python 3.8 or above.

License in practice

Licensed under GPL (copyleft). Use in proprietary software requires careful review of licensing obligations, as copyleft terms may require derivative works to be open-source.

Quickstart

pip install extract-msg

import extract_msg
msg = extract_msg.openMsg("path/to/file.msg")
# Access msg.from_, msg.to, msg.cc, msg.date, msg.subject, msg.body

# Or from command line:
# python -m extract_msg example.msg

Requires Python 3.8 or above.

Verify before relying

  • Whether all output formats (HTML, PDF, RTF, JSON) are equally well-supported or have known limitations
  • Performance characteristics when processing large .msg files or batch extraction scenarios
  • Compatibility with .msg files from different Outlook versions or edge cases in MAPI property structure

Package facts

License GPL (copyleft)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 7 — olefile, tzlocal, compressed-rtf, ebcdic, beautifulsoup4, RTFDE, red-black-tree-mod
Maintenance actively maintained — 0 days since the last release
Last repo commit
First released
Downloads 7,184,387/month — #1,774 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: extract_msg-0.56.1-py3-none-any.whl

Tags

outlook msg file extractionemail attachment extractormsg parser pythonextract outlook emailsmsg to html converteremail data extractionoutlook message parser
email-parsingoutlook-msgfile-extraction

More Utilities packages