--- id: rtfde version: "0.1.2.2" license: unclear license_treatment: copyleft maintenance: aging --- # RTFDE — A library for extracting HTML content from RTF encapsulated HTML as commonly found in the exchange MSG email format. License: copyleft · Maintenance: aging · Downloads: 6.6M/mo ## What it is and what it does RTFDE is a Python library that reverses Microsoft Exchange's RTF encapsulation of email body content. When Outlook or Exchange stores HTML or plain text email bodies, they wrap them in RTF format; this library extracts the original HTML or text from that wrapper. It depends on lark (for parsing) and oletools (for RTF/OLE handling) and is designed specifically for .msg file processing. The library handles two main tasks: extracting HTML from RTF-encapsulated HTML, and extracting plain text from RTF-encapsulated text. It fully unquotes the extracted content, which means escaped sequences (like Quoted-Printable encoding) are decoded. Known limitations include inability to integrate attachments back into HTML bodies and no support for extracting plain text from RTF-encapsulated HTML (you would use another HTML parser for that). Use it for: - Parse .msg email files and recover the original HTML body content instead of the RTF wrapper. - Batch-process Exchange-exported emails to extract and re-render body content as clean HTML or text. - Build email archival or migration tools that need to normalize RTF-wrapped content from older Outlook exports. - Integrate with oletools-based email forensics workflows to de-encapsulate message bodies. - Convert RTF-encapsulated plain text from .msg files back to readable text for indexing or search. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Extracts encapsulated HTML and plain text content from RTF bodies in .msg email files, reversing the RTF encapsulation that Microsoft Exchange applies. Yes, if you need to extract HTML or text from RTF-encapsulated .msg email bodies. The library is narrow in scope, low friction to install, and has no known vulnerabilities. The aging maintenance status and small community (8 stars) mean it is unlikely to gain new features, but the core task is stable and unlikely to require frequent updates. Suitable for production use in email processing pipelines where RTF de-encapsulation is a known requirement. ## Install pip install rtfde uv add rtfde poetry add rtfde ## Installing RTFDE Before you install: Low friction: pure Python wheel with only two runtime dependencies (lark and oletools). Maintenance is aging—last release was 248 days ago and the repository has minimal activity (8 stars), but it remains archived=false and the codebase is stable for its narrow scope. License in practice: Licensed under LGPLv3 (copyleft). You may use and modify the library freely, but any derivative work must also be distributed under LGPLv3; static linking or bundling into proprietary software requires careful legal review. Quickstart: from RTFDE.deencapsulate import DeEncapsulator with open('rtf_file', 'rb') as fp: raw_rtf = fp.read() rtf_obj = DeEncapsulator(raw_rtf) rtf_obj.deencapsulate() if rtf_obj.content_type == 'html': print(rtf_obj.html) else: print(rtf_obj.text) Requires Python >= 3.8. Input must be raw RTF bytes (typically from a .msg file body). Verify before relying: - How well does de-encapsulation handle modern Exchange RTF variants and edge cases beyond the documented known issues? - Performance characteristics with large RTF payloads or batch processing of many .msg files. - Compatibility with oletools versions and whether oletools updates could affect behavior. ## Package facts - License: not declared (copyleft) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 6.6M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags rtf de-encapsulation, extract html from rtf, msg file content extraction, rtf to html converter, email body decoding, exchange msg parser, rtf deencapsulator, email-processing, rtf-parsing, msg-extraction [View on SkillFed](https://skillfed.io/packages/rtfde) · [View on PyPI](https://pypi.org/project/rtfde/)