Repository navigation
Conversation
The sendMail JSON payload silently dropped the In-Reply-To and References headers set on the Mail object: Graph's internetMessageHeaders only accepts x-* custom headers, so standard threading headers cannot be transmitted that way at all. Replies sent through this gem therefore never threaded in the recipient's client. Map both headers to their MAPI extended properties instead (PidTagInReplyToId 0x1042, PidTagInternetReferences 0x1039), which Exchange translates back into the wire headers. Bare message ids from the mail gem's parsed accessors are re-wrapped in angle brackets to match the RFC 5322 format.
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.
Problem
The
sendMailJSON payload silently drops theIn-Reply-ToandReferencesheaders set on the Mail object. Graph'sinternetMessageHeadersonly acceptsx-*custom headers, so standard threading headers cannot be transmitted that way at all. Replies sent through this gem therefore never thread in the recipient's mail client — every reply starts a new conversation.Found while auditing the case-email integration in m2-api, where
CaseMailersets both headers for reply mails.Fix
Map both headers to their MAPI extended properties in the message payload:
In-Reply-ToPidTagInReplyToIdString 0x1042ReferencesPidTagInternetReferencesString 0x1039Exchange translates these back into the wire headers on send. Bare message ids from the mail gem's parsed accessors are re-wrapped in angle brackets to match the RFC 5322 format. The properties are omitted entirely when neither header is set, so payloads for non-reply mail are unchanged.
Tests
deliver!covering: both headers transmitted, bare ids wrapped, properties omitted without headers, and the basic payload shape (the spec file was an empty placeholder before).bundle exec rake test(RuboCop + RSpec) green.