Skip to content

Conversation

@ReemX
Copy link

@ReemX ReemX commented Jan 10, 2026

Summary

  • Adds a new --clients CLI option to the dev command that allows users to specify which email clients to show compatibility warnings for
  • Useful for teams that only target specific email clients (e.g., corporate environments using only Outlook)
  • Also supports the COMPATIBILITY_EMAIL_CLIENTS environment variable

Usage

# Show only Outlook compatibility warnings
email dev --clients outlook

# Show warnings for multiple clients
email dev --clients "outlook,gmail,apple-mail"

Details

  • If --clients is not specified, defaults to ['gmail', 'apple-mail', 'outlook', 'yahoo'] (existing behavior)
  • Invalid client names are filtered out and ignored
  • If all specified clients are invalid, falls back to defaults
  • Supported clients: gmail, outlook, yahoo, apple-mail, aol, thunderbird, microsoft, samsung-email, sfr, orange, protonmail, hey, mail-ru, fastmail, laposte, t-online-de, free-fr, gmx, web-de, ionos-1and1, rainloop, wp-pl

Changes

  • packages/react-email/src/index.ts - Added --clients CLI option
  • packages/react-email/src/commands/dev.ts - Pass clients option through
  • packages/react-email/src/utils/preview/start-dev-server.ts - Pass to env builder
  • packages/react-email/src/utils/preview/get-env-variables-for-preview-app.ts - Add COMPATIBILITY_EMAIL_CLIENTS env var
  • packages/preview-server/src/app/env.ts - Export new env var
  • packages/preview-server/src/utils/caniemail/email-clients.ts - NEW: Extracted types and constants from server action
  • packages/preview-server/src/actions/email-validation/check-compatibility.ts - Use configurable email clients

Test plan

  • Build passes
  • Manual test with --clients outlook to verify only Outlook warnings shown
  • Manual test with invalid client names to verify fallback behavior

Closes #2796


Summary by cubic

Adds a --clients option to the dev and build commands plus a COMPATIBILITY_EMAIL_CLIENTS env var to filter compatibility warnings to chosen email clients. Keeps default clients unchanged so teams can focus on targets without noise.

  • New Features

    • CLI: email dev --clients outlook or email dev --clients "outlook,gmail,apple-mail"
    • CLI (build): supports the same --clients flag
    • ENV: COMPATIBILITY_EMAIL_CLIENTS for configuration without CLI flags
    • Validation: CLI errors on invalid client names; default is gmail, apple-mail, outlook, yahoo
  • Refactors

    • Extracted email client types and list to utils/caniemail/email-clients.ts
    • Threaded clients from CLI → preview env → compatibility check
    • Adopted @t3-oss/env-nextjs for typed env handling and bumped zod

Written for commit 1692826. Summary will update on new commits.

@vercel
Copy link

vercel bot commented Jan 10, 2026

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

A member of the Team first needs to authorize it.

@changeset-bot
Copy link

changeset-bot bot commented Jan 10, 2026

⚠️ No Changeset found

Latest commit: 1692826

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 Jan 10, 2026

Open in StackBlitz

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

commit: 1692826

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.

2 issues found across 9 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/react-email/src/utils/preview/start-dev-server.ts">

<violation number="1" location="packages/react-email/src/utils/preview/start-dev-server.ts:35">
P2: Port retry drops the new --clients option: compatibilityClients isn’t passed when startDevServer recurses after EADDRINUSE, so retries ignore the user’s client filter.</violation>
</file>

<file name="packages/react-email/src/utils/preview/get-env-variables-for-preview-app.ts">

<violation number="1" location="packages/react-email/src/utils/preview/get-env-variables-for-preview-app.ts:16">
P2: Undefined compatibilityClients overwrites existing COMPATIBILITY_EMAIL_CLIENTS when merging env, breaking user-provided env var support.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Ask questions if you need clarification on any suggestion

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

PREVIEW_SERVER_LOCATION: previewServerLocation,
USER_PROJECT_LOCATION: cwd,
RESEND_API_KEY: resendApiKey,
COMPATIBILITY_EMAIL_CLIENTS: compatibilityClients,
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Jan 10, 2026

Choose a reason for hiding this comment

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

P2: Undefined compatibilityClients overwrites existing COMPATIBILITY_EMAIL_CLIENTS when merging env, breaking user-provided env var support.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/react-email/src/utils/preview/get-env-variables-for-preview-app.ts, line 16:

<comment>Undefined compatibilityClients overwrites existing COMPATIBILITY_EMAIL_CLIENTS when merging env, breaking user-provided env var support.</comment>

<file context>
@@ -5,12 +5,14 @@ export const getEnvVariablesForPreviewApp = (
     PREVIEW_SERVER_LOCATION: previewServerLocation,
     USER_PROJECT_LOCATION: cwd,
     RESEND_API_KEY: resendApiKey,
+    COMPATIBILITY_EMAIL_CLIENTS: compatibilityClients,
   } as const;
 };
</file context>
Suggested change
COMPATIBILITY_EMAIL_CLIENTS: compatibilityClients,
...(compatibilityClients !== undefined
? { COMPATIBILITY_EMAIL_CLIENTS: compatibilityClients }
: {}),
Fix with Cubic

…patibility warnings

Adds a new `--clients` CLI option to the `dev` command that allows users to specify
which email clients to show compatibility warnings for. This is useful for teams
that only target specific email clients (e.g., corporate environments that only use
Outlook).

Usage:
  email dev --clients outlook
  email dev --clients "outlook,gmail,apple-mail"

If not specified, defaults to ['gmail', 'apple-mail', 'outlook', 'yahoo'].

Also supports the COMPATIBILITY_EMAIL_CLIENTS environment variable for
configuration without CLI flags.

Closes resend#2796
@ReemX ReemX force-pushed the feat/configurable-email-clients branch from 82d77b5 to 866fa3f Compare January 10, 2026 22:48
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.

2 issues found across 21 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


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

<violation number="1" location="packages/preview-server/src/actions/email-validation/check-compatibility.ts:15">
P2: COMPATIBILITY_EMAIL_CLIENTS is no longer normalized/validated; invalid/empty values now suppress all compatibility warnings instead of falling back to defaults.</violation>
</file>

<file name="packages/preview-server/src/actions/get-email-path-from-slug.ts">

<violation number="1" location="packages/preview-server/src/actions/get-email-path-from-slug.ts:10">
P1: User-controlled slug is joined without containment checks, allowing path traversal/absolute-path override outside EMAILS_DIR_ABSOLUTE_PATH before file access.</violation>
</file>

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

export const getEmailPathFromSlug = cache(async (slug: string) => {
if (['.tsx', '.jsx', '.ts', '.js'].includes(path.extname(slug)))
return path.join(emailsDirectoryAbsolutePath, slug);
return path.join(env.EMAILS_DIR_ABSOLUTE_PATH, slug);
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Jan 12, 2026

Choose a reason for hiding this comment

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

P1: User-controlled slug is joined without containment checks, allowing path traversal/absolute-path override outside EMAILS_DIR_ABSOLUTE_PATH before file access.

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/get-email-path-from-slug.ts, line 10:

<comment>User-controlled slug is joined without containment checks, allowing path traversal/absolute-path override outside EMAILS_DIR_ABSOLUTE_PATH before file access.</comment>

<file context>
@@ -3,13 +3,13 @@
 export const getEmailPathFromSlug = cache(async (slug: string) => {
   if (['.tsx', '.jsx', '.ts', '.js'].includes(path.extname(slug)))
-    return path.join(emailsDirectoryAbsolutePath, slug);
+    return path.join(env.EMAILS_DIR_ABSOLUTE_PATH, slug);
 
-  const pathWithoutExtension = path.join(emailsDirectoryAbsolutePath, slug);
</file context>
Fix with Cubic

getUsedStyleProperties,
} from '../../utils/caniemail/ast/get-used-style-properties';
import {
relevantEmailClients,
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Jan 12, 2026

Choose a reason for hiding this comment

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

P2: COMPATIBILITY_EMAIL_CLIENTS is no longer normalized/validated; invalid/empty values now suppress all compatibility warnings instead of falling back to defaults.

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/email-validation/check-compatibility.ts, line 15:

<comment>COMPATIBILITY_EMAIL_CLIENTS is no longer normalized/validated; invalid/empty values now suppress all compatibility warnings instead of falling back to defaults.</comment>

<file context>
@@ -13,8 +12,7 @@ import {
 import {
-  allEmailClients,
-  type EmailClient,
+  relevantEmailClients,
   type SupportEntry,
 } from '../../utils/caniemail/email-clients';
</file context>
Fix with Cubic

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 7 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/preview-server/src/app/env.ts">

<violation number="1" location="packages/preview-server/src/app/env.ts:22">
P2: `skipValidation: true` disables all env validation and default application, allowing missing/invalid env vars to reach runtime</violation>
</file>

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

.optional()
.default('false'),
},
skipValidation: true,
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Jan 12, 2026

Choose a reason for hiding this comment

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

P2: skipValidation: true disables all env validation and default application, allowing missing/invalid env vars to reach runtime

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

<comment>`skipValidation: true` disables all env validation and default application, allowing missing/invalid env vars to reach runtime</comment>

<file context>
@@ -10,12 +10,16 @@ export const env = createEnv({
+      .optional()
+      .default('false'),
   },
+  skipValidation: true,
   experimental__runtimeEnv: {
     NEXT_PUBLIC_IS_BUILDING: process.env.NEXT_PUBLIC_IS_BUILDING,
</file context>
Suggested change
skipValidation: true,
- skipValidation: true,
+ skipValidation: process.env.SKIP_ENV_VALIDATION === 'true',
Fix with Cubic

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.

Feature: Allow filtering email client compatibility warnings

2 participants