Skip to content

Commit 700dc6f

Browse files
authored
feat: Use content_id for inline attachments (#118)
1 parent 96243e7 commit 700dc6f

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
resend (0.22.0)
4+
resend (0.23.0)
55
httparty (>= 0.21.0)
66

77
GEM

examples/with_attachments.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
{
3939
"path": "https://resend.com/static/brand/resend-wordmark-black.png",
4040
"filename": "resend-wordmark-black.png",
41-
"inline_content_id": "image"
41+
"content_id": "image"
4242
}
4343
]
4444
}

lib/resend/mailer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def get_attachments(mail)
221221
}
222222

223223
# Rails uses the auto generated cid for inline attachments
224-
attachment[:inline_content_id] = part.cid if part.inline?
224+
attachment[:content_id] = part.cid if part.inline?
225225
attachments.append(attachment)
226226
end
227227
attachments

spec/railtie/mailer_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class TestMailerWithDisplayName < TestMailer
153153
expect(body[:attachments].length).to eql(1)
154154
expect(body[:attachments].first[:filename]).to eql("invoice.pdf")
155155
expect(body[:attachments].first[:content].length > 0).to be true
156-
expect(body[:attachments].first[:inline_content_id]).to be_nil
156+
expect(body[:attachments].first[:content_id]).to be_nil
157157
end
158158

159159
it "properly creates a html text with inline attachments msg" do
@@ -166,7 +166,7 @@ class TestMailerWithDisplayName < TestMailer
166166
expect(body[:attachments].length).to eql(1)
167167
expect(body[:attachments].first[:filename]).to eql("logo.png")
168168
expect(body[:attachments].first[:content].length > 0).to be true
169-
expect(body[:attachments].first[:inline_content_id]).to_not be_nil
169+
expect(body[:attachments].first[:content_id]).to_not be_nil
170170
end
171171

172172
it "properly handles from display name" do

0 commit comments

Comments
 (0)