docs: add a guide for testing emails with Resend (ENG-1577)
Merged
SA
2d ago+500+500+012345678901234567890123456789-3-3-0123456789
What
- A "Test emails with Resend" page (
/test-emails-resend) in the "Guides" group of the docs sidebar. The page shows a test that signs up with a Resend test address, then reads the sent email with the Resend SDK. It also shows how to read received email withemails.receiving. - A hand-run Resend suite in the testbed:
pnpm --filter @e2e-dev/testbed test:resend.
Why
Users who test sign-up or password-reset flows need to read the email their app sends. This page shows how to do it with Resend's own SDK.
How it works
docs/docs.jsonadds the page to the "Guides" group, after the AgentMail guide. The page sits at the top level asdocs/test-emails-resend.mdx, next todocs/test-emails.mdx.- The code on the page lives in
docs/examples/resend/. The docs typecheck covers it, andscripts/check-docs-examples.tsmaps each file to the page, so the page copy can't drift.docs/package.jsonaddsresend@6.40.1for the typecheck. - The example test (
docs/examples/resend/tests/signup.e2e.ts) signs up withdelivered+<uuid>@resend.dev. It waits intoPass()for that email to show up inemails.list()as delivered, then checks its subject and HTML withemails.get(). Resend calls return{ data, error }, so the test checkserrorafter each one. - The config passes
RESEND_API_KEYto the app withinheritEnvand registers it withregisterProviderKey, so e2e redacts it. The guide uses one full-access key for both the app and the test on purpose. That keeps the setup simple. The cost is that the app gets more access than sending needs. emails.list()has no recipient filter and returns at most 100 emails per page. The Limits section tells readers to run against a dedicated Resend team so other email doesn't push the test's email off the first page.apps/testbed/e2e.resend.config.tsrunsapp/resend-signup.mjs, a sign-up page that sends through the real Resend API. When Resend refuses a send or the request fails, the page shows the reason with a 502 status, and the app keeps running.tests-resend/signup.e2e.tschecks a delivered address, a bounced address, and a receiving-domain address. The receiving test skips unlessRESEND_RECEIVING_DOMAINand a verifiedRESEND_FROMare set. The default testbed config doesn't pick uptests-resend/, so CI never runs it..fallowrc.jsonlists the app as an entry, and the README documents the variables.
Choices a fresh-context review questioned that I kept:
- The page is a tutorial in the inclusive "we" voice, with an "In this guide, we ..." sentence and an "Installation" heading. The page owner chose this voice, so the authoring-docs rules that say otherwise don't apply here.
- The vendor logo and overview card rules cover integrations, CI services and migration guides. A guide is none of those, so it has no logo or card.
Verified
Ran it locally: yes
pnpm check,pnpm testandpnpm --filter @e2e-dev/testbed testpass on this change.- The testbed Resend suite, run against the real Resend API:
✓ |web| tests-resend/signup.e2e.ts > a welcome email reaches a delivered test address 2.63s
✓ |web| tests-resend/signup.e2e.ts > a welcome email to a bounced test address bounces 1.41s
↓ |web| tests-resend/signup.e2e.ts > a welcome email arrives at the receiving domain [Set RESEND_RECEIVING_DOMAIN and a verified RESEND_FROM to send real email.]
Tests 2 passed | 1 skipped (3)
- The receiving test hasn't been run on the head commit, because it needs a receiving domain that wasn't set up in this environment.
- I didn't capture screenshots of the rendered page because there's no local docs renderer. The docs preview deploy on this PR shows it.
- Shortening pass: the page is new, at 172 lines. It doesn't say a fact twice, so I made no cuts.
Summary by CodeRabbit
- New Features
- Added Resend examples for verifying signup email delivery and bounce events, with optional incoming-email checks.
- Added a signup testbed that can send up to three real emails through Resend and display an inbox-check message after a successful signup.
- Documentation
- Added a Resend guide covering setup, sent and received email checks, test addresses, and API limits.
- Added instructions for running the live test suite and configuring the required environment variables.