ms-graph-mailer 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 469b5d7a57ff7c226a55b9e73cd2995ee229f9f22824e9155585d905c66b5887
4
- data.tar.gz: 4a358f5c1ea87954bfa99169a41faa6f226d2fc80a054dede48ced754b32a6ac
3
+ metadata.gz: bc38df909076fbf11baa641699ca2e813f683ab2dc95dc6c69c27b897bc85cd3
4
+ data.tar.gz: f48660fa9212b12343c92ef9a8786965fa8dfc3b86705c7c46cf86e339991557
5
5
  SHA512:
6
- metadata.gz: fa851676f45ced636be7c356cf7f33dc36ecc2685d9fb6662692756b0fdcae2fbb908f30b5b9908c08a88192c2f1858e78b1bf23d982e6034b9e25b3373245c7
7
- data.tar.gz: 2c9a35d08b4579a65bd9c1596d0074cf21368f596c0a5a18362d4136e40981a1e521ad89a88b6bf25f5a6e8059ae9e67149c9b72cccdffdabcd1be6e78afa9ed
6
+ metadata.gz: '09014fecd0b2d3a1d5fdd417c887acdd9b6580cccf5a8e19c38ee92e9a44634785ccb2cab4865e96cb2814c61da89bc9ba6bbe9826cde8b30bbd452a25154743'
7
+ data.tar.gz: 6ea5c55727621b5fad871add5d91dc18ec55fa31648718a33531227cfcac7162b3fa20cd14a46a2038d3d5e2cb7e614ebc95cf5670680d9baf8ab55c4d058855
data/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.1.1] - 2026-11-06
9
+
10
+ ### Fixed
11
+
12
+ - `In-Reply-To` and `References` headers are no longer dropped when sending.
13
+ The JSON `sendMail` payload cannot carry standard internet message headers,
14
+ so they are now mapped to their MAPI extended properties
15
+ (`PidTagInReplyToId` / `PidTagInternetReferences`), keeping replies threaded
16
+ in the recipient's mail client.
17
+
8
18
  ## [1.1.0] - 2026-11-06
9
19
 
10
20
  ### Added
@@ -58,6 +68,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
58
68
  - Configuration system for tenant, client credentials
59
69
  - Integration with Rails logger
60
70
 
71
+ [1.1.1]: https://github.com/zauberware/ms-graph-mailer/releases/tag/v1.1.1
61
72
  [1.1.0]: https://github.com/zauberware/ms-graph-mailer/releases/tag/v1.1.0
62
73
  [1.0.0]: https://github.com/zauberware/ms-graph-mailer/releases/tag/v1.0.0
63
74
  [0.1.0]: https://github.com/zauberware/ms-graph-mailer/releases/tag/v0.1.0
@@ -4,6 +4,10 @@ module MsGraphMailer
4
4
  class DeliveryMethod
5
5
  include Dry::Monads[:result]
6
6
 
7
+ # PidTagInReplyToId (0x1042) / PidTagInternetReferences (0x1039)
8
+ IN_REPLY_TO_PROPERTY_ID = 'String 0x1042'
9
+ REFERENCES_PROPERTY_ID = 'String 0x1039'
10
+
7
11
  attr_reader :settings
8
12
 
9
13
  # INFO: settings is passed from config.action_mailer.<environment>
@@ -101,14 +105,42 @@ module MsGraphMailer
101
105
  ccRecipients: build_recipients(mail.cc),
102
106
  bccRecipients: build_recipients(mail.bcc),
103
107
  replyTo: build_recipients(mail.reply_to),
104
- attachments: build_attachments(mail)
108
+ attachments: build_attachments(mail),
109
+ singleValueExtendedProperties: build_threading_properties(mail)
105
110
  }.tap do |msg|
106
- %i[toRecipients ccRecipients bccRecipients replyTo attachments].each do |field|
111
+ %i[toRecipients ccRecipients bccRecipients replyTo attachments singleValueExtendedProperties].each do |field|
107
112
  msg.delete(field) if msg[field].blank?
108
113
  end
109
114
  end
110
115
  end
111
116
 
117
+ # Graph's sendMail only accepts x-* custom headers via
118
+ # internetMessageHeaders, so the standard threading headers
119
+ # (In-Reply-To/References) would silently get lost. Mapping them to their
120
+ # MAPI extended properties makes Exchange emit them on the wire, keeping
121
+ # replies threaded in the recipient's client.
122
+ def build_threading_properties(mail)
123
+ properties = []
124
+
125
+ in_reply_to = format_message_ids(mail.in_reply_to)
126
+ references = format_message_ids(mail.references)
127
+
128
+ properties << { id: IN_REPLY_TO_PROPERTY_ID, value: in_reply_to } if in_reply_to
129
+ properties << { id: REFERENCES_PROPERTY_ID, value: references } if references
130
+ properties
131
+ end
132
+
133
+ # The mail gem parses message-id fields to bare ids (no angle brackets);
134
+ # the RFC 5322 header format Exchange writes needs them re-added.
135
+ def format_message_ids(ids)
136
+ formatted = Array(ids).compact.map(&:to_s).reject(&:empty?).map do |id|
137
+ id.start_with?('<') ? id : "<#{id}>"
138
+ end
139
+ return nil if formatted.empty?
140
+
141
+ formatted.join(' ')
142
+ end
143
+
112
144
  def build_body(mail)
113
145
  if mail.multipart?
114
146
  html_part = mail.html_part
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MsGraphMailer
4
- VERSION = '1.1.0'
4
+ VERSION = '1.1.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ms-graph-mailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zauberware Technologies GmbH
@@ -80,104 +80,90 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.3'
83
- - !ruby/object:Gem::Dependency
84
- name: bundler
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '2.0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '2.0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: rake
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
87
  - - "~>"
102
88
  - !ruby/object:Gem::Version
103
- version: '13.0'
89
+ version: '13.4'
104
90
  type: :development
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
94
  - - "~>"
109
95
  - !ruby/object:Gem::Version
110
- version: '13.0'
96
+ version: '13.4'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: rspec
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
101
  - - "~>"
116
102
  - !ruby/object:Gem::Version
117
- version: '3.0'
103
+ version: '3.13'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
108
  - - "~>"
123
109
  - !ruby/object:Gem::Version
124
- version: '3.0'
110
+ version: '3.13'
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: rubocop
127
113
  requirement: !ruby/object:Gem::Requirement
128
114
  requirements:
129
115
  - - "~>"
130
116
  - !ruby/object:Gem::Version
131
- version: '1.0'
117
+ version: '1.92'
132
118
  type: :development
133
119
  prerelease: false
134
120
  version_requirements: !ruby/object:Gem::Requirement
135
121
  requirements:
136
122
  - - "~>"
137
123
  - !ruby/object:Gem::Version
138
- version: '1.0'
124
+ version: '1.92'
139
125
  - !ruby/object:Gem::Dependency
140
126
  name: rubocop-rake
141
127
  requirement: !ruby/object:Gem::Requirement
142
128
  requirements:
143
129
  - - "~>"
144
130
  - !ruby/object:Gem::Version
145
- version: '0.6'
131
+ version: '0.7'
146
132
  type: :development
147
133
  prerelease: false
148
134
  version_requirements: !ruby/object:Gem::Requirement
149
135
  requirements:
150
136
  - - "~>"
151
137
  - !ruby/object:Gem::Version
152
- version: '0.6'
138
+ version: '0.7'
153
139
  - !ruby/object:Gem::Dependency
154
140
  name: rubocop-rspec
155
141
  requirement: !ruby/object:Gem::Requirement
156
142
  requirements:
157
143
  - - "~>"
158
144
  - !ruby/object:Gem::Version
159
- version: '2.0'
145
+ version: '3.10'
160
146
  type: :development
161
147
  prerelease: false
162
148
  version_requirements: !ruby/object:Gem::Requirement
163
149
  requirements:
164
150
  - - "~>"
165
151
  - !ruby/object:Gem::Version
166
- version: '2.0'
152
+ version: '3.10'
167
153
  - !ruby/object:Gem::Dependency
168
154
  name: webmock
169
155
  requirement: !ruby/object:Gem::Requirement
170
156
  requirements:
171
157
  - - "~>"
172
158
  - !ruby/object:Gem::Version
173
- version: '3.0'
159
+ version: '3.34'
174
160
  type: :development
175
161
  prerelease: false
176
162
  version_requirements: !ruby/object:Gem::Requirement
177
163
  requirements:
178
164
  - - "~>"
179
165
  - !ruby/object:Gem::Version
180
- version: '3.0'
166
+ version: '3.34'
181
167
  description: A custom delivery method for ActionMailer that sends emails via Microsoft
182
168
  Graph API using OAuth 2.0 client credentials flow
183
169
  email: