feat(email): add Outlook .msg support and optional attachment listing#3873
Open
DanielNg0729 wants to merge 1 commit into
Open
feat(email): add Outlook .msg support and optional attachment listing#3873DanielNg0729 wants to merge 1 commit into
DanielNg0729 wants to merge 1 commit into
Conversation
Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
Contributor
|
✅ DCO Check Passed Thanks @DanielNg0729, all your commits are properly signed off. 🎉 |
Contributor
Merge Protections🔴 1 of 2 protections blocking · waiting on 👀 reviews
🔴 Require two reviewer for test updatesWaiting for
This rule is failing.When test data is updated, we require two reviewers
Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi maintainers, this PR is to follow up with #3716.
Issue resolved by this Pull Request:
Resolves #3712
With Docling's README and
docs/usage/supported_formats.mdalready advertise email parsing for both.emland.msg, but only.eml(viamail-parser) was actually implemented. This PR adds native Outlook.msgparsing and an opt-inlisting of attachment names for both formats, using the MIT-licensed
Aspose.Email FOSS library suggested in the discussion.
Library choice
Reading
.msg(OLE2/Compound File Binary + MAPI) usesaspose-email-foss:It is added only to the existing
format-emailextra, so default/slim installs are unaffected.How it works
The
.msgpath is a thin bridge rather than a second renderer: a.msgis detected by its OLE2/CFB magic bytes, loaded via Aspose, and projected onto standard RFC 822 bytes (MapiMessage.to_email_bytes()). Those bytes flow through the samemail-parsercode path already used for.eml, so subject/from/to/date, plain-text and HTML bodies, and attachments are handled identically for both formats.Both the
mail-parserandaspose-email-fossimports are guarded (same pattern as #3613), soimport doclingstill works without the extra; using a.msgwithout the dependency raises an actionableformat-emailinstall hint.Optional attachment listing
New
EmailBackendOptions(list_attachments=False)(opt-in). When enabled, an "Attachments" section listing each attachment's filename and content type is appended. Attachment payload bytes are never embedded, only names/types and consistent with existing.emlbehavior.Note
DocumentOrigin.mimetypeonly accepts registered MIME types (noapplication/vnd.ms-outlook), so the origin staysmessage/rfc822for both inputs; the.msgdistinction is kept via the filename fallback and thebackend.is_msgflag.Testing
New
.msgtests (path, stream, converter, attachment listing) plus a regression row asserting graceful degradation whenaspose-email-fossis absent, 32 tests pass acrosstest_backend_email.pyandtest_backend_optional_dependencies.py.ruff,ty, andtachare clean anduv.lockis regenerated.Checklist: