skillfed

tnefparse

a TNEF decoding library written in Python, without external dependencies

tnefparse v1.4.0 189.3K downloads/30d#9,932 on PyPI51
Copyleft license LGPL Active released

What it is and what it does

tnefparse is a pure-Python library for decoding TNEF (Transport Neutral Encapsulation Format), a Microsoft format used to wrap email message content and attachments. It parses TNEF streams and exposes the decoded message components—attachments, body text (plain, HTML, or RTF), MAPI properties, and metadata—as Python objects. The library includes both a programmatic API for integration into applications and a command-line utility for direct file inspection and extraction.

With no external dependencies beyond Python itself, it runs on CPython 3.6+ and PyPy3. The package has been actively maintained since 2012, with recent improvements including embedded message object support, JSON export, and type annotations. It is commonly used to handle winmail.dat files and other TNEF-encoded messages that arrive in email systems, particularly those interoperating with Microsoft Exchange or Outlook.

Use it for:

  • Extract attachments from winmail.dat files received in email systems that use TNEF encoding.
  • Parse and recover message body content (plain text, HTML, or RTF) from TNEF-wrapped emails in mail processing pipelines.
  • Inspect TNEF file structure and MAPI properties for debugging email interoperability issues between systems.
  • Batch convert TNEF attachments to ZIP archives or extract them to a specified directory via the command-line tool.
  • Build email archival or forensic tools that need to decode and index TNEF-formatted messages.

Worth the install?

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

Decodes Microsoft's Transport Neutral Encapsulation Format (TNEF) and extracts attachments, message bodies, and metadata from TNEF-encoded email messages.

Yes. The package is production-stable, actively maintained, has zero known vulnerabilities, and requires no external dependencies. Install it if you need to parse TNEF files or extract attachments from Microsoft-encoded email messages. The LGPL license is permissive for most use cases but requires source disclosure if you distribute derivative works.

Install

tnefparse on PyPI

pip

pip install tnefparse

uv

uv add tnefparse

poetry

poetry add tnefparse

Installing tnefparse

Before you install

Low friction: pure-Python wheel with no runtime dependencies. Actively maintained as of 2026-05-13 with recent commits; last release 2021-01-24 is stable and production-ready.

License in practice

LGPL copyleft license: you may use and modify the library freely, but derivative works must remain under LGPL and source must be made available to recipients.

Quickstart

pip install tnefparse

from tnefparse import TNEF
with open("message.tnef", "rb") as f:
    tnef_obj = TNEF(f.read())
    for attachment in tnef_obj.attachments:
        print(attachment.filename)

Requires Python 3.6 or later (or PyPy3); Python 2 is no longer supported.

Verify before relying

  • Whether the package handles all TNEF variants and edge cases in real-world email systems
  • Performance characteristics when parsing very large TNEF files or archives with many attachments
  • Completeness of MAPI property support beyond what is documented in the changelog

Package facts

License LGPL (copyleft)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 2,028 days since the last release
Last repo commit
First released
Downloads 189,253/month — #9,932 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: tnefparse-1.4.0-py3-none-any.whl

Keywords: TNEF, MAPI, decoding, mail, email, microsoft

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: End Users/DesktopLicense :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)Programming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Communications :: Email

Tags

TNEF decoding libraryextract TNEF attachmentsMicrosoft TNEF parseremail TNEF formatMAPI property extractionwinmail.dat parserTNEF to attachment conversion
email-parsingtnef-formatattachment-extraction

More Email packages