feat: add EmlConverter with attachment support
Summary
Adds EmlConverter for converting RFC 822 .eml files to markdown.
This extends the gap identified in issue #1662. The converter handles:
- Email headers (From, To, Cc, Subject, Date)
- Body content (prefers
text/plain, falls back totext/htmlwith tag stripping) - Attachments: each attachment is passed through the MarkItDown converter pipeline and rendered under its own heading in the output
What this PR covers
converters/_eml_converter.py- newEmlConverterclassconverters/__init__.py- registers the new converter in exports_markitdown.py- registersEmlConverter(markitdown=self)inenable_builtins(), matching theZipConverterpattern for recursive conversiontests/test_eml_converter.py- 11 tests covering headers, body, attachment conversion, unsupported format fallback, and body/attachment isolation
Attachment design
Attachment conversion follows the same pattern as ZipConverter: a MarkItDown instance is injected via the constructor and used to call convert_stream() on each attachment. This means any format markitdown supports (XLSX, PDF, DOCX, etc.) is automatically available for email attachments with no additional code.
If no MarkItDown instance is available (e.g., the converter is instantiated directly), attachments are listed by filename with a note rather than silently skipped.
Example output
# Email Message
**From:** [email protected]
**To:** [email protected]
**Subject:** Q1 Report
**Date:** Sat, 04 Apr 2026 12:00:00 +0000
## Content
Please find the Q1 report attached.
## Attachments
### Q1_Report.xlsx
## Sheet1
| Quarter | Revenue |
|---------|---------|
| Q1 2026 | 1.2M |
Testing
All 11 tests pass. ruff check and ruff format pass with zero issues.
Closes #1662
@microsoft-github-policy-service agree