Skip to content

fix(preview): drop U+FEFF from the whitespace filler so senders don't blank the email#3681

Open
AdamFarrar wants to merge 1 commit into
resend:mainfrom
AdamFarrar:fix/preview-bom-blank-email
Open

fix(preview): drop U+FEFF from the whitespace filler so senders don't blank the email#3681
AdamFarrar wants to merge 1 commit into
resend:mainfrom
AdamFarrar:fix/preview-bom-blank-email

Conversation

@AdamFarrar

@AdamFarrar AdamFarrar commented Jul 24, 2026

Copy link
Copy Markdown

The problem

<Preview>'s hidden preview-text padding includes  (BOM / ZERO WIDTH NO-BREAK SPACE) in whiteSpaceCodes:

const whiteSpaceCodes = '\xa0‌​‍‎‏';

It's repeated PREVIEW_MAX_LENGTH - text.length times, so a short preview emits a long run of these characters — including many BOMs — near the top of the <body>. A mid-document BOM is treated as a stream marker by some HTML/MIME parsers (notably SendGrid, which re-parses the HTML for tracking), and they truncate everything after it. The body and CTA get dropped and the email renders completely blank in Gmail / Apple Mail. The multipart/alternative plain-text part is unaffected, which is why the failure can look intermittent.

This matches several existing reports:

The fix

Drop  from whiteSpaceCodes. The other six characters (\xa0 ‌ ​ ‍ ‎ ‏) are ordinary no-break / zero-width characters that still pad the preview snippet, so there's no visible change for clients that handle the filler correctly — the parser-breaking BOM is simply removed.

Snapshots in preview.spec.tsx and packages/ui's get-email-component.spec.ts are updated to match; both pass.


Summary by cubic

Removed U+FEFF (BOM) from the <Preview> component’s hidden whitespace filler to stop some senders (e.g., SendGrid) from truncating HTML and rendering emails blank. The remaining zero‑width characters still pad the preview; snapshots updated accordingly.

Written for commit 6a2736b. Summary will update on new commits.

Review in cubic

… blank the email

The hidden preview-text padding in `<Preview>` includes U+FEFF (BOM /
ZERO WIDTH NO-BREAK SPACE). A mid-document BOM is treated as a stream
marker by some HTML/MIME parsers — notably SendGrid's — which truncate
everything after it, so the body and CTA are dropped and the email
renders completely blank in Gmail and Apple Mail.

The other six zero-width characters still pad the preview snippet, so
there is no visible change for clients that handle the filler correctly.

Removes U+FEFF from `whiteSpaceCodes` and updates the affected snapshots.

Refs resend#609, resend#1785, resend#1806
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

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

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6a2736b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
react-email Patch
@react-email/editor Patch
@react-email/ui Patch

Not sure what this means? Click here to learn what changesets are.

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

@github-actions github-actions Bot added the linear-synced PR has been synced to Linear label Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linear-synced PR has been synced to Linear

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant