Skip to content

feat: allow overriding Resend API key and specifying from address via CLI flag#2978

Open
josepjaume wants to merge 3 commits intoresend:canaryfrom
Ramensoft:claude/add-resend-api-key-param-nUbPY
Open

feat: allow overriding Resend API key and specifying from address via CLI flag#2978
josepjaume wants to merge 3 commits intoresend:canaryfrom
Ramensoft:claude/add-resend-api-key-param-nUbPY

Conversation

@josepjaume
Copy link

@josepjaume josepjaume commented Feb 26, 2026

Description

This PR adds support for passing a Resend API key directly via a CLI flag (--resend-api-key) to the dev command, allowing users to override the stored configuration without modifying their config file.

Changes

  • Added --resend-api-key <key> option to the dev command CLI
  • Added --from <address> option to the dev command CLI
  • Updated the dev command handler to accept and pass through the resendApiKey parameter
  • Modified startDevServer to accept an optional resendApiKey parameter
  • Updated the preview server initialization to use the CLI-provided API key if available, falling back to the stored config value

Motivation

This enables users to:

  • Temporarily use a different Resend API key without modifying their stored configuration
  • Use different API keys in different environments or CI/CD pipelines
  • Override the default config on a per-command basis

Test Plan

The change is straightforward and follows the existing pattern for CLI options. Verify that:

  • Running dev --resend-api-key <key> correctly passes the key to the preview server
  • The CLI flag takes precedence over the stored config value
  • Omitting the flag falls back to the stored config as before

https://claude.ai/code/session_01S5bPtnwuCfk37VUe6RFHT7


Summary by cubic

Add --resend-api-key and --from to the dev command to run the preview server with a custom Resend API key and sender. When both are set, test emails send directly via your Resend account instead of the hosted API; includes minor formatting fixes in preview-server components.

  • New Features
    • dev now accepts --resend-api-key and --from
    • Preview app uses local Resend send when both are provided; otherwise falls back to stored config and the hosted test endpoint

Written for commit 2b91d05. Summary will update on new commits.

Allow configuring the Resend API key directly via a CLI parameter
on the dev command, which overrides the stored config from
`resend setup`. This makes it easier to use in CI/scripted
environments without running the interactive setup.

https://claude.ai/code/session_01S5bPtnwuCfk37VUe6RFHT7
@vercel
Copy link

vercel bot commented Feb 26, 2026

@claude is attempting to deploy a commit to the resend Team on Vercel.

A member of the Team first needs to authorize it.

@josepjaume josepjaume marked this pull request as ready for review February 26, 2026 10:29
@changeset-bot
Copy link

changeset-bot bot commented Feb 26, 2026

⚠️ No Changeset found

Latest commit: 2b91d05

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 26, 2026

Open in StackBlitz

npm i https://pkg.pr.new/resend/react-email/@react-email/preview-server@2978
npm i https://pkg.pr.new/resend/react-email@2978

commit: 2b91d05

Copy link
Contributor

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

Choose a reason for hiding this comment

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

No issues found across 3 files

Confidence score: 5/5

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

When both --resend-api-key and --from are provided, the preview app
sends test emails directly through the user's Resend account with
the specified sender address, instead of the hosted react.email API.

https://claude.ai/code/session_01S5bPtnwuCfk37VUe6RFHT7
Copy link
Contributor

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

Choose a reason for hiding this comment

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

1 issue found across 9 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/preview-server/src/actions/send-email.ts">

<violation number="1" location="packages/preview-server/src/actions/send-email.ts:30">
P1: Custom agent: **API Key Permission Check SDK Methods**

This PR introduces a new Resend SDK method (`emails.send`) but does not include an explicit permission-readiness check/reminder for production API keys. Per the API Key Permission Check SDK Methods rule, confirm and document that deployed Resend keys have send-email permission before rollout to prevent runtime authorization failures.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.


const resend = new Resend(resendApiKey);

const response = await resend.emails.send({
Copy link
Contributor

Choose a reason for hiding this comment

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

P1: Custom agent: API Key Permission Check SDK Methods

This PR introduces a new Resend SDK method (emails.send) but does not include an explicit permission-readiness check/reminder for production API keys. Per the API Key Permission Check SDK Methods rule, confirm and document that deployed Resend keys have send-email permission before rollout to prevent runtime authorization failures.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/preview-server/src/actions/send-email.ts, line 30:

<comment>This PR introduces a new Resend SDK method (`emails.send`) but does not include an explicit permission-readiness check/reminder for production API keys. Per the API Key Permission Check SDK Methods rule, confirm and document that deployed Resend keys have send-email permission before rollout to prevent runtime authorization failures.</comment>

<file context>
@@ -0,0 +1,43 @@
+
+    const resend = new Resend(resendApiKey);
+
+    const response = await resend.emails.send({
+      from: fromAddress,
+      to: [parsedInput.to],
</file context>

@josepjaume josepjaume changed the title feat(react-email): Allow overriding Resend API key via CLI flag feat: Allow overriding Resend API key and specifying from address via CLI flag Feb 26, 2026
@josepjaume josepjaume changed the title feat: Allow overriding Resend API key and specifying from address via CLI flag feat: allow overriding Resend API key and specifying from address via CLI flag Feb 26, 2026
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