tnefparse
a TNEF decoding library written in Python, without external dependencies
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 tnefparseuv
uv add tnefparsepoetry
poetry add tnefparseInstalling 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
Tags
More Email packages
aiosmtplib is an asynchronous SMTP client that…
permissive · top 5,000 on PyPI
Wikipedia-APIWikipedia-API is a Python wrapper for…
permissive · top 5,000 on PyPI
python-oxmsgParses Outlook MSG files to extract email…
permissive · top 5,000 on PyPI
django-anymailSends and receives email in Django through…
permissive · top 5,000 on PyPI
IMAPClientIMAPClient provides a Pythonic interface to…
permissive · top 5,000 on PyPI
mailjet-restA Python wrapper for the Mailjet Email API that…
permissive · top 5,000 on PyPI
extract-msgExtracts email metadata (from, to, cc, date,…
copyleft · top 5,000 on PyPI
RTFDEExtracts encapsulated HTML and plain text…
copyleft · top 5,000 on PyPI
mail-parserParses raw email messages into structured…
permissive · top 5,000 on PyPI
rtfparseParses Microsoft Rich Text Format (RTF)…
permissive · top 15,000 on PyPI
cabarchiveA pure-Python library for creating and…
copyleft · top 15,000 on PyPI
eml-parserParses EML (email) files and extracts…
agpl · top 15,000 on PyPI
msg-parserParses Microsoft Outlook MSG email files,…
permissive · top 15,000 on PyPI
pyrfc6266Parses RFC 6266 Content-Disposition headers to…
permissive · top 15,000 on PyPI
striprtfConverts Rich Text Format (RTF) files to plain…
permissive · top 5,000 on PyPI