From be966cb241f9ddcb9cb794f03043c51bba553f85 Mon Sep 17 00:00:00 2001 From: Derich Pacheco Date: Thu, 7 Aug 2025 17:57:03 -0300 Subject: [PATCH] feat: prefer content_id instead of inline_content_id --- examples/with_inline_attachments.py | 4 ++-- resend/emails/_attachment.py | 8 ++++++++ tests/emails_test.py | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/examples/with_inline_attachments.py b/examples/with_inline_attachments.py index fc0c492..0261aa3 100644 --- a/examples/with_inline_attachments.py +++ b/examples/with_inline_attachments.py @@ -31,11 +31,11 @@ print("Sent email with local inline attachment") print(local_email) -# Send email with remote inline attachment +# Send email with remote inline attachment using content_id remote_attachment: resend.RemoteAttachment = { "filename": "remote-resend-wordmark-black.png", "path": "https://resend.com/static/brand/resend-wordmark-black.png", - "inline_content_id": "my-test-image", + "content_id": "my-test-image", # Using content_id as alternative to inline_content_id } remote_params: resend.Emails.SendParams = { diff --git a/resend/emails/_attachment.py b/resend/emails/_attachment.py index 24376ce..0660f59 100644 --- a/resend/emails/_attachment.py +++ b/resend/emails/_attachment.py @@ -25,6 +25,10 @@ class Attachment(TypedDict): """ inline_content_id: NotRequired[str] """ + Alternative way to set the Content ID for inline attachments (same as content_id) + """ + content_id: NotRequired[str] + """ Content ID for inline attachments used in HTML content with cid: references """ @@ -40,5 +44,9 @@ class RemoteAttachment(TypedDict): """ inline_content_id: NotRequired[str] """ + Alternative way to set the Content ID for inline attachments (same as content_id) + """ + content_id: NotRequired[str] + """ Content ID for inline attachments used in HTML content with cid: references """ diff --git a/tests/emails_test.py b/tests/emails_test.py index 00cfac4..dfacc68 100644 --- a/tests/emails_test.py +++ b/tests/emails_test.py @@ -144,7 +144,7 @@ def test_email_send_with_inline_attachment(self) -> None: "filename": "image.png", "content": [1, 2, 3, 4, 5], "content_type": "image/png", - "inline_content_id": "my-image", + "content_id": "my-image", } params: resend.Emails.SendParams = {