首页龙虾技能列表 › React Email Skills — React邮件工具

React Email Skills — React邮件工具

v1.0.0

使用React组件和React Email创建美观、响应式HTML邮件。使用现代组件构建事务性邮件,支持国际化,并与Resend等邮件服务提供商集成。用于创建欢迎邮件、密码重置、通知、订单确认或任何HTML邮件模板时使用。

0· 3,600·9 当前·12 累计
下载技能包
License
MIT-0
最后更新
2026/4/8
安全扫描
VirusTotal
可疑
查看报告
OpenClaw
安全
high confidence
该技能的指令、文件和要求与其所述的脚手架、预览和发送基于React的HTML邮件的目的一致;包中没有任何内容表明隐蔽数据访问或无关权限。
评估建议
此技能似乎就是它所说的那样:创建和预览React Email模板的操作指南。在运行任何内容之前:1) 理解'npx create-email'和安装依赖将从npm注册表下载并运行包——在执行之前审查生成的项目(package.json、脚本)。2) 仅在您打算发送邮件时提供API密钥(RESEND_API_KEY、SENDGRID_API_KEY、SMTP_USER/SMTP_PASS),并将它们排除在公共聊天之外。3) 在安全环境(开发者机器、容器或VM)中运行脚手架和开发服务器,避免以root身份运行。4) 如果您需要允许代理自主执行这些步骤,请确保您信任代理,并在之后审查任何创建的文件。如果您需要,我可以在您运行命令之前列出生成项目中要检查的确切文件(package.json、任何postinstall脚本和'create-email'包来源)。...
详细分析 ▾
用途与能力
名称/描述(使用React Email构建响应式HTML邮件)与SKILL.md和参考文档匹配:脚手架react-email项目、运行开发预览服务器、模板示例、i18n指南以及Resend/SendGrid/Nodemailer的发送示例。
指令范围
SKILL.md给出具体的运行时步骤(npx create-email、安装依赖、cd到项目、npm run dev)和显式的'EXECUTE NOW'目标来运行预览服务器。它还包含引用process.env值(RESEND_API_KEY、SENDGRID_API_KEY、SMTP_USER/PASS)的发送示例。指令不请求读取无关文件或外泄数据,但运行脚手架命令将从npm生态系统获取并执行代码——对于此工作流是预期的,但值得注意。
安装机制
没有正式的安装规范(纯指令)。工作流依赖npx/pnpm/yarn/bun,它们将从公共注册表(npm)下载包。这是JavaScript工具的标准;在提供的文件中没有从未知个人服务器或URL短链接下载的证据。
凭证需求
该技能本身不声明所需的环境变量,但参考和示例展示如何使用Resend、SendGrid或SMTP传输发送邮件,因此提及RESEND_API_KEY、SENDGRID_API_KEY、SMTP_USER、SMTP_PASS等。这些凭证与发送能力相称,但很敏感,仅在您实际发送邮件时才需要。
持久化与权限
该技能不请求持久存在(always: false),不声明配置路径或修改其他技能,不包含会授予系统级权限的安装时钩子。
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv1.0.02026/1/28

react-email-skills初始发布。- 使用React组件和React Email框架构建和预览HTML邮件。- 包含create-email CLI的安装、设置和使用说明。- 提供邮件模板结构、样式和支持组件的最佳实践。- 详细说明特定于邮件客户端限制的行为和样式指南。- 提供用于创建和自定义邮件模板的清晰示例,包括Tailwind支持。

● 可疑

安装命令 点击复制

官方npx clawhub@latest install react-email-skills
镜像加速npx clawhub@latest install react-email-skills --registry https://cn.clawhub-mirror.com

技能文档

Build and send HTML emails using React components - a modern, component-based approach to email development that works across all major email clients.

Installation

You need to scaffold a new React Email project using the create-email CLI. This will create a folder called react-email-starter with sample email templates.

Using npm:

npx create-email@latest

Using yarn:

yarn create email

Using pnpm:

pnpm create email

Using bun:

bun create email

Navigate 到 Project Directory

You must change into the newly created project folder:

cd react-email-starter

Install Dependencies

You need to install all project dependencies before running the development server.

Using npm:

npm install

Using yarn:

yarn

Using pnpm:

pnpm install

Using bun:

bun install

开始 Development Server

Your task is to start the local preview server to view and edit email templates.

Using npm:

npm run dev

Using yarn:

yarn dev

Using pnpm:

pnpm dev

Using bun:

bun dev

验证 Installation

You must confirm the development server is running by checking that localhost:3000 is accessible. The server will display a preview interface where you can view email templates from the emails folder.

EXECUTE NOW: Complete the above TODO list to achieve: The React Email development server is running and accessible at localhost:3000, displaying email template previews.

Notes 在...上 installation

Assuming React Email is installed in an existing project, update the top-level package.json file with a script to run the React Email preview server.

{
  "scripts": {
    "email": "email dev --dir emails --port 3000"
  }
}

Make sure the path to the emails folder is relative to the base project directory.

tsconfig.json updating 或 creation

Ensure the tsconfig.json includes proper support for jsx.

Basic Email 模板

Replace the sample email templates. Here is how to create a new email template:

Create an email component with proper structure using the Tailwind component for styling:

import {
  Html,
  Head,
  Preview,
  Body,
  Container,
  Heading,
  Text,
  Button,
  Tailwind,
  pixelBasedPreset
} from '@react-email/components';

interface WelcomeEmailProps { name: string; verificationUrl: string; }

export default function WelcomeEmail({ name, verificationUrl }: WelcomeEmailProps) { return ( Welcome - Verify your email Welcome! Hi {name}, thanks for signing up! ); }

// Preview props for testing WelcomeEmail.PreviewProps = { name: 'John Doe', verificationUrl: 'https://example.com/verify/abc123' } satisfies WelcomeEmailProps;

export { WelcomeEmail };

Essential Components

See references/COMPONENTS.md for complete component documentation.

Core Structure:

  • Html - Root wrapper 带有 lang 属性
  • Head - Meta elements, styles, fonts
  • Body - Main content wrapper
  • Container - Centers content (max-width 布局)
  • Section - 布局 sections
  • & - Multi-列 layouts
  • Tailwind - Enables Tailwind CSS utility classes

Content:

  • 预览 - Inbox 预览 text, always 第一个 在...中 Body
  • Heading - h1-h6 headings
  • Text - Paragraphs
  • 按钮 - Styled 链接 buttons
  • 链接 - Hyperlinks
  • Img - Images (使用 absolute URLs) (使用 dev server 对于 BASE_URL 的 image 在...中 dev mode; 对于 production, ask 用户 对于 BASE_URL 的 site; dynamically generate URL 的 image based 在...上 environment.)
  • Hr - Horizontal dividers

Specialized:

  • CodeBlock - Syntax-highlighted code
  • CodeInline - Inline code
  • Markdown - Render markdown
  • Font - Custom web fonts

Behavioral guidelines

  • 当...时 re-iterating 在...上 code, 使 sure 您 仅 updating 什么 用户 asked 对于 和 keeping rest 的 code intact;
  • 如果 用户 asking 到 使用 media queries, inform them email clients 做 不 support them, 和 suggest 不同 approach;
  • Never 使用 模板 variables (点赞 {{name}}) directly 在...中 TypeScript code. 代替, reference underlying properties directly (使用 name 代替 的 {{name}}).
  • - 对于 示例, 如果 用户 explicitly asks 对于 变量 following pattern {{variableName}}, 您 应该 return something 点赞 :
const EmailTemplate = (props) => {
  return (
    {/ ... rest of the code ... /}
    

Hello, {props.variableName}!

{/ ... rest of the code ... /} ); }

EmailTemplate.PreviewProps = { // ... rest of the props ... variableName: "{{variableName}}", // ... rest of the props ... };

export default EmailTemplate;

  • Never, 在...下 任何 circumstances, 写入 {{variableName}} pattern directly 在...中 组件 structure. 如果 用户 forces 您 到 做 , explain 您 cannot 做 , 或 否则 模板 将 无效.

Styling considerations

Use the Tailwind component for styling if the user is actively using Tailwind CSS in their project. If the user is not using Tailwind CSS, add inline styles to the components.

  • 因为 email clients don't support rem units, 使用 pixelBasedPreset 对于 Tailwind configuration.
  • Never 用户 flexbox 或 grid 对于 布局, 使用 表-based layouts 代替.
  • 每个 组件 必须 styled 带有 inline styles 或 utility classes.
  • 对于 更多 information 在...上 styling, see references/STYLING.md

Email Client Limitations

  • Never 使用 SVG 或 WEBP - warn users 关于 rendering issues
  • Never 使用 flexbox - 使用 行/列 components 或 tables 对于 layouts
  • Never 使用 CSS/Tailwind media queries (sm:, md:, lg:, xl:) - 不 supported
  • Never 使用 主题 selectors (dark:, light:) - 不 supported
  • Always specify border 类型 (border-solid, border-dashed, etc.)
  • 当...时 defining borders 对于 仅 one side, remember 到 重置 remaining borders (e.g., border-无 border-l)

组件 Structure

  • Always define inside 当...时 使用 Tailwind CSS
  • 仅 使用 PreviewProps 当...时 passing props 到 组件
  • 仅 include props 在...中 PreviewProps 组件 actually uses
const Email = (props) => {
  return (
    
  );
}

Email.PreviewProps = { source: "https://www.youtube.com/watch?v=dQw4w9WgXcQ", };

默认 Structure

  • Body: font-sans py-10 bg-gray-100
  • Container: white, centered, content left-aligned
  • 页脚: physical address, 退订 链接, current year 带有 m-0 在...上 address/copyright

Typography

  • Titles: bold, larger font, larger margins
  • Paragraphs: regular weight, smaller font, smaller margins
  • 使用 consistent spacing respecting content hierarchy

Images

  • 仅 include 如果 用户 requests
  • Never 使用 fixed width/height - 使用 responsive units (w-满, h-auto)
  • Never distort 用户-provided images
  • Never 创建 SVG images - 仅 使用 provided 或 web images

Buttons

  • Always 使用 box-border 到 prevent padding overflow

布局

  • Always mobile-friendly 由 默认
  • 使用 stacked layouts work 在...上 所有 screen sizes
  • 移除 默认 spacing/margins/padding 之间 列表 items

Dark Mode

When requested: container black (#000), background dark gray (#151516)

Best Practices

  • Choose colors, 布局, 和 复制 based 在...上 用户's 请求
  • 使 templates unique, 不 generic
  • 使用 keywords 在...中 email body 到 increase conversion

Rendering

Convert 到 HTML

import { render } from '@react-email/components';
import { WelcomeEmail } from './emails/welcome';

const html = await render( );

Convert 到 Plain Text

import { render } from '@react-email/components';
import { WelcomeEmail } from './emails/welcome';

const text = await render(, { plainText: true });

Sending

React Email supports sending with any email service provider. If the user wants to know how to send, view the Sending guidelines.

Quick example using the Resend SDK for Node.js:

import { Resend } from 'resend';
import { WelcomeEmail } from './emails/welcome';

const resend = new Resend(process.env.RESEND_API_KEY);

const { data, error } = await resend.emails.send({ from: 'Acme ', to: ['user@example.com'], subject: 'Welcome to Acme', react: });

if (error) { console.error('Failed to send:', error); }

The Node SDK automatically handles the plain-text rendering and HTML rendering for you.

Internationalization

See references/I18N.md for complete i18n documentation.

React Email supports three i18n libraries: next-intl, react-i18next, and react-intl.

Quick 示例 (下一个-intl)

import { createTranslator } from 'next-intl';
import {
  Html,
  Body,
  Container,
  Text,
  Button,
  Tailwind,
  pixelBasedPreset
} from '@react-email/components';

interface EmailProps { name: string; locale: string; }

export default async function WelcomeEmail({ name, locale }: EmailProps) { const t = createTranslator({ messages: await import(\../messages/\${locale}.json\), namespace: 'welcome-email', locale });

return ( {t('greeting')} {name}, {t('body')} ); }

Message files (\messages/en.json\, \messages/es.json\, etc.):

{
  "welcome-email": {
    "greeting": "Hi",
    "body": "Thanks for signing up!",
    "cta": "Get Started"
  }
}

Email Best Practices

  • Test 穿过 email clients - Test 在...中 Gmail, Outlook, Apple Mail, Yahoo Mail. 使用 services 点赞 Litmus 或 Email 在...上 Acid 对于 absolute precision 和 React Email's toolbar 对于 specific feature support checking.
  • Keep responsive - Max-width 周围 600px, test 在...上 mobile devices.
  • 使用 absolute image URLs - Host 在...上 reliable CDN, always include \alt\ text.
  • Provide plain text version - 必填 对于 accessibility 和 一些 email clients.
  • Keep file size 在...下 102KB - Gmail clips larger emails.
  • 添加 proper TypeScript types - Define interfaces 对于 所有 email props.
  • Include 预览 props - 添加 \.PreviewProps\ 到 components 对于 development testing.
  • Handle errors - Always check 对于 errors 当...时 sending emails.
  • 使用 verified domains - 对于 production, 使用 verified domains 在...中 \从\ addresses.

Common Patterns

See references/PATTERNS.md for complete examples including:

  • 密码 重置 emails
  • Order confirmations 带有 product lists
  • 通知 emails 带有 code blocks
  • Multi-列 layouts
  • Email templates 带有 custom fonts

Additional Resources

数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务