Skip to content

feat: add ReceivedFor to the received email type - #139

Merged
gabrielmfern merged 1 commit into
mainfrom
feat/received-for-inbound-retrieve
Aug 18, 2026
Merged

feat: add ReceivedFor to the received email type#139
gabrielmfern merged 1 commit into
mainfrom
feat/received-for-inbound-retrieve

Conversation

@gabrielmfern

@gabrielmfern gabrielmfern commented Aug 17, 2026

Copy link
Copy Markdown
Member

The retrieve received email endpoint returns a received_for array — "the recipient addresses the email was forwarded for, taken from the for clause of the message's Received headers" — but ReceivedEmail had no property for it, so the value was silently dropped on deserialization.

EmailEventData in Resend.Webhooks already had ReceivedFor, so this brings the API model in line with the webhook model. Same EmailAddressList? type and JsonIgnore pattern as the neighbouring Cc/Bcc/ReplyTo properties.

Two things worth noting:

No test is included because there is no existing test that deserializes ReceivedEmail to extend, and a test asserting only that a new property round-trips would restate the attribute rather than cover behaviour. Happy to add one if you would rather have the coverage.

ReceivedEmail backs both retrieve and list, so the property appears on list results too, where it will be null. That matches how TextBody, HtmlBody, and the other retrieve-only fields already behave on this type. The list endpoint docs do not document received_for.

Related: the field is still missing from the OpenAPI spec, which is what DEV-1626 is about.

🤖 Generated with Claude Code


Summary by cubic

Expose forwarded-for recipients on retrieved emails.

Previously, the SDK dropped the retrieve endpoint’s received_for array during deserialization; now ReceivedEmail.ReceivedFor captures it, aligning the API model with the webhook EmailEventData and docs.

  • Uses EmailAddressList? with JsonIgnore(WhenWritingNull), matching Cc/Bcc/ReplyTo.
  • Appears on list results but will be null, consistent with other retrieve-only fields.
  • No migration required; this adds a nullable property.
  • Linear DEV-1626: partially addressed by surfacing the field in the SDK; the OpenAPI spec still omits received_for.

Written for commit 1076fa0. Summary will update on new commits.

Review in cubic

Ref DEV-1626

The retrieve received email endpoint returns a received_for array, but
ReceivedEmail did not decode it. The webhook type (EmailEventData) already
had it. Documented at
https://resend.com/docs/api-reference/emails/retrieve-received-email

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@gabrielmfern
gabrielmfern marked this pull request as ready for review August 17, 2026 19:39

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Adds a nullable ReceivedFor field to the response DTO, mirroring the webhook model and JsonIgnore pattern. This is purely additive deserialization coverage with no behavior or contract changes.

Re-trigger cubic

Approval not submitted

This repository is configured to approve as @klotty, but that approval identity is unavailable.
Reconnect or verify the approval identity in repository settings.

cubic left this as a normal review comment instead of falling back to a Cubic App approval.

@gabrielmfern
gabrielmfern marked this pull request as draft August 17, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants