Repository navigation
fix(email): keep display name of Exchange recipients in .msg files - #5704
shashank11yadav wants to merge 1 commit into
Conversation
For a .msg recipient inside an Exchange organisation, python-oxmsg returns the legacy Exchange DN as the address when no SMTP address is stored. formataddr() put it in the angle brackets, mailparser dropped the mailbox, and the converted document lost the recipient, or the whole To/Cc line. As for the sender, keep the display name of such a recipient and render the header from the .msg recipients when one of them has no SMTP address. The name is taken from PidTagDisplayName directly, so a DN with "(FYDIBOHF23SPDLT)" or a name with a comma is not re-parsed. Signed-off-by: Shashank Yadav <65058495+shashank11yadav@users.noreply.github.com>
|
✅ DCO Check Passed Thanks @shashank11yadav, all your commits are properly signed off. 🎉 |
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
AI triage (advisory)Checked commit The change keeps the display name of a Topic labels added: CI safety: no concern found. A maintainer must still approve CI. 1 related pull request(s) in the same code
The |
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the full diff at 5d570ecc6f. It read the code and did not run it.
I found no defect that blocks the merge. I traced the new recipient loop and the convert() override in docling/backend/email_backend.py. Recipients with an SMTP address still take the old formataddr path. A recipient without one now shows only its display name, and the shown text goes through _header_safe and _quote_display_name. The new tests cover the comma, parentheses and header-injection cases.
A maintainer makes the merge decision. This review never approves the pull request.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
The .msg converter lost a To or Cc recipient whenever that recipient had no SMTP address. Inside an Exchange organisation, python-oxmsg returns the legacy Exchange DN (
/O=.../CN=...) as the address in that case. The recipient loop passed the DN throughformataddr(), so mailparser found no usable mailbox and dropped the recipient. When every recipient in a header was like this, the whole To or Cc line was missing from the converted document.For a recipient with no SMTP address, the header now keeps only the display name. The To or Cc text is built from the .msg recipients in their original order, using the same quoting and header-safety helpers as the sender path. The display name is read from its own property rather than re-parsed from a combined string, so a DN with parentheses or a name with a comma is handled. A recipient with neither an address nor a name is skipped. Messages where every recipient has an SMTP address take the same path as before.
_msg_to_rfc822_bytesnow returns a third value, the per-header text. The email tests that call it are updated for the new return shape. No documentation, examples or test data changed.Issue resolved by this Pull Request:
Fixes #5703
Checklist:
Review evidence: