{"name":"build-transactional-email-with-resend","description":"Sends welcome, password-reset and order-receipt mail through Resend, using React Email templates, after a server event. Use this when the user wants a sign-up email, a reset link, a receipt, or transactional mail that is not a contact form.","category":"backend","tags":["email","react"],"models":["any"],"proven":false,"passing_families":0,"model_testing":"Not yet model-tested; testing Jan 2027","url":"https://theskillvault.ai/skills/build-transactional-email-with-resend","api_url":"https://theskillvault.ai/api/skills/build-transactional-email-with-resend","raw_url":"https://theskillvault.ai/api/skills/build-transactional-email-with-resend/raw","body":"# Build transactional email with Resend\n\nThese messages are triggered by your server: an account was created, a reset was requested, or an order was paid. They are not a form that visitors fill in to reach you. For that, use build-contact-form-with-email.\n\n## When to use\n- You need a welcome message after sign-up.\n- You issue your own password-reset link and must email it.\n- You need a receipt after payment, with the order id and total.\n\n## When not to use\n- The message is an enquiry from a contact form to the site owner.\n- Supabase Auth or Clerk already sends the reset mail. Do not send a second one.\n\n## Steps\n1. Verify the sending domain in Resend and add the DNS records it shows. Production mail uses that domain, not the shared test sender.\n2. Install `resend` and `react-email`. Put `RESEND_API_KEY` in `.env.local` and on the host. Never prefix it with `NEXT_PUBLIC_`.\n3. Write one template per message under something like `emails/`: welcome, reset, receipt. Import layout pieces from `react-email`. Pass props in. Do not query the database inside the template.\n4. Send only from a server route, server action or webhook. Pass the template as a function call, `WelcomeEmail({ name, url })`, not as JSX. Branch on `{ data, error }`.\n5. Pass `idempotencyKey` as the second argument, shaped like `welcome-user/${userId}` or `receipt/${orderId}`. A key placed inside the email object is dropped, and a retry can send twice. Keys last 24 hours and must be 1 to 256 characters.\n6. Welcome: send once when the account row exists. Reset: only if your app created the token. Store a hash of the token, make the link single-use, and expire it within an hour. Use the same reply whether or not the address is registered.\n7. Receipt: send from the paid webhook, after the order is stored. Include the order id, the line items and the total. Never include the full card number.\n8. Include a plain-text part as well as HTML. Preview the templates before they go to a real inbox.\n\n```ts\nconst { data, error } = await resend.emails.send(\n  {\n    from: \"Shop <receipts@your-domain.com>\",\n    to: [customerEmail],\n    subject: `Receipt ${orderId}`,\n    react: ReceiptEmail({ orderId, items, total }),\n  },\n  { idempotencyKey: `receipt/${orderId}` },\n);\n```\n\n## Gotchas\n- `onboarding@resend.dev` is a test sender. Mail from it will not stand in for your domain in production.\n- The React prop must be a function call. JSX here is a common reason the send fails types.\n- A webhook that retries without an idempotency key emails the buyer again.\n- Reset links in HTML and in logs are secrets. Do not log the rendered message.\n\n## Safety\n- The API key stays in the server environment. Do not paste it into chat, a screenshot or the repo.\n- A reset token and a full receipt are personal data. Send them only to the address on the account or the order.\n\n## Portability\nWorks with any framework that can run the Resend Node SDK. If you use another email provider instead of Resend, keep the same split: React templates, a server-only send, and an idempotency key per event. If you are not on React, send HTML you rendered yourself and keep the trigger rules.\n\n## Example prompt\n\"Send a one-time receipt with Resend and React Email after the order is paid. Do not email twice on webhook retries.\"\n\n## Done when\n- Welcome, reset and receipt each have a template and a server trigger.\n- A repeated webhook with the same idempotency key does not send a second receipt.\n- The API key is not in client code, and the reset email does not reveal whether the account exists.\n\n---\nHouse original by TheSkillVault (CC-BY-4.0).","files":[],"license":"CC-BY-4.0","license_name":"CC BY 4.0","license_url":"https://creativecommons.org/licenses/by/4.0/","attribution":"From TheSkillVault, https://theskillvault.ai, CC BY 4.0","install":{"claude_code":"curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/build-transactional-email-with-resend/raw' -o ~/'.claude/skills/build-transactional-email-with-resend/SKILL.md'","cursor":"curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/build-transactional-email-with-resend/raw' -o '.cursor/skills/build-transactional-email-with-resend/SKILL.md'","agents":"curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/build-transactional-email-with-resend/raw' -o '.agents/skills/build-transactional-email-with-resend/SKILL.md'","mcp_url":"https://theskillvault.ai/mcp","cursor_mcp_deeplink":"cursor://anysphere.cursor-deeplink/mcp/install?name=theskillvault&config=eyJ1cmwiOiJodHRwczovL3RoZXNraWxsdmF1bHQuYWkvbWNwIn0%3D","mcp_config":{"mcpServers":{"theskillvault":{"url":"https://theskillvault.ai/mcp"}}}},"bundles":[],"tested_on":[{"family":"chatgpt","name":"ChatGPT","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"claude","name":"Claude","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"gemini","name":"Gemini","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"grok","name":"Grok","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"llama","name":"Llama","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"deepseek","name":"DeepSeek","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"mistral","name":"Mistral","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"qwen","name":"Qwen","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"kimi","name":"Kimi K","outcome":null,"date":null,"source":null,"counts":false,"stale":false}],"proven_rule":{"threshold":5,"window_days":365,"computed_at":"2026-11-29T03:42:30.374Z"}}