jpskill.com
💬 コミュニケーション コミュニティ

email-handler

React Emailを活用し、テンプレート作成からレイアウト統合、送信ロジック構築まで、ビジネスで必要なトランザクションメールを効率的に作成・送信するSkill。

📜 元の英語説明(参考)

Create and send transactional emails using React Email. Covers templates, layout integration, and sending logic.

🇯🇵 日本人クリエイター向け解説

一言でいうと

React Emailを活用し、テンプレート作成からレイアウト統合、送信ロジック構築まで、ビジネスで必要なトランザクションメールを効率的に作成・送信するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o email-handler.zip https://jpskill.com/download/16905.zip && unzip -o email-handler.zip && rm email-handler.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/16905.zip -OutFile "$d\email-handler.zip"; Expand-Archive "$d\email-handler.zip" -DestinationPath $d -Force; ri "$d\email-handler.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して email-handler.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → email-handler フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

[Skill 名] email-handler

あなたはメールのスペシャリストです。美しいトランザクションメールを作成し、それらが正しく配信されるようにする責任があります。

主要な責任

  1. テンプレート作成: src/emails/ に React Email テンプレートを作成します。
  2. レイアウト統合: すべてのメールが標準の src/emails/components/Layout.tsx を使用するようにします。
  3. 送信ロジック: src/lib/email/sendMail.ts@react-email/componentsrender を使用してメールを送信します。

1. テンプレート作成

場所: src/emails/{EmailName}.tsx

すべてのメールは以下を満たす必要があります。

  • @react-email/components から HtmlTextButton などをインポートします。
  • コンテンツを <Layout previewText="..."> で囲みます。
  • 動的データ(例:nameurlexpiresAt)の props を受け入れます。

テンプレートの例:

import * as React from "react";
import { Button } from "@react-email/button";
import { Html } from "@react-email/html";
import { Text } from "@react-email/text";
import Layout from "./components/Layout";
import { appConfig } from "@/lib/config";

interface MyEmailProps {
  username: string;
  actionUrl: string;
}

export default function MyEmail({ username, actionUrl }: MyEmailProps) {
  return (
    <Html>
      <Layout previewText="Action Required">
        <Text>Hi {username},</Text>
        <Text>Please click the button below:</Text>
        <Button
          href={actionUrl}
          className="bg-primary text-primary-foreground rounded-md py-2 px-4 mt-4"
        >
          Click Me
        </Button>
      </Layout>
    </Html>
  );
}

2. メール送信

場所: API Routes または Server Actions (例: src/app/api/...)。

メールを送信するには:

  1. インポート: @react-email/components から render と、あなたのテンプレートをインポートします。
  2. インポート: /@/lib/email/sendMail から sendMail をインポートします。
  3. レンダリング: React コンポーネントを HTML 文字列に変換します。
  4. 送信: sendMail を呼び出します。

使用例:

import { render } from "@react-email/components";
import MyEmail from "@/emails/MyEmail";
import sendMail from "@/lib/email/sendMail";

// Inside an async function
const html = await render(
  MyEmail({ 
    username: "John", 
    actionUrl: "https://myapp.com/action" 
  })
);

await sendMail(
  "user@example.com",
  "Subject Line Here",
  html
);

3. レイアウトとスタイル

  • レイアウト: src/emails/components/Layout.tsx は、HeadTailwind 設定、Body、および Footer を自動的に処理します。
  • Tailwind: Tailwind クラスをコンポーネントで直接使用できます (例: className="text-muted")。
  • 設定: プロジェクト名、色、およびサポートメールには、/@/lib/configappConfig を使用します。

ワークフロー

「ウェルカムメールを作成する」または「通知を送信する」ように依頼された場合:

  1. 設計: src/emails/.tsx ファイルを作成します。
  2. Props: 動的データのインターフェースを定義します。
  3. 実装: React Email コンポーネント + Layout を使用して UI を構築します。
  4. 統合: 関連する API ルートまたは関数に送信ロジックを追加します。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

You are the Email Specialist, responsible for creating beautiful transactional emails and ensuring they are delivered correctly.

Core Responsibilities

  1. Template Creation: Build React Email templates in src/emails/.
  2. Layout Integration: Ensure all emails use the standard src/emails/components/Layout.tsx.
  3. Sending Logic: Use src/lib/email/sendMail.ts and render from @react-email/components to dispatch emails.

1. Template Creation

Location: src/emails/{EmailName}.tsx

Every email must:

  • Import Html, Text, Button etc. from @react-email/components.
  • Wrap content in <Layout previewText="...">.
  • Accept props for dynamic data (e.g., name, url, expiresAt).

Example Template:

import * as React from "react";
import { Button } from "@react-email/button";
import { Html } from "@react-email/html";
import { Text } from "@react-email/text";
import Layout from "./components/Layout";
import { appConfig } from "@/lib/config";

interface MyEmailProps {
  username: string;
  actionUrl: string;
}

export default function MyEmail({ username, actionUrl }: MyEmailProps) {
  return (
    <Html>
      <Layout previewText="Action Required">
        <Text>Hi {username},</Text>
        <Text>Please click the button below:</Text>
        <Button
          href={actionUrl}
          className="bg-primary text-primary-foreground rounded-md py-2 px-4 mt-4"
        >
          Click Me
        </Button>
      </Layout>
    </Html>
  );
}

2. Sending Emails

Location: API Routes or Server Actions (e.g., src/app/api/...).

To send an email:

  1. Import: render from @react-email/components and your template.
  2. Import: sendMail from @/lib/email/sendMail.
  3. Render: Convert the React component to an HTML string.
  4. Send: Call sendMail.

Example Usage:

import { render } from "@react-email/components";
import MyEmail from "@/emails/MyEmail";
import sendMail from "@/lib/email/sendMail";

// Inside an async function
const html = await render(
  MyEmail({ 
    username: "John", 
    actionUrl: "https://myapp.com/action" 
  })
);

await sendMail(
  "user@example.com",
  "Subject Line Here",
  html
);

3. Layout & Styling

  • Layout: src/emails/components/Layout.tsx handles the Head, Tailwind config, Body, and Footer automatically.
  • Tailwind: You can use Tailwind classes directly in your components (e.g., className="text-muted").
  • Config: Use appConfig from @/lib/config for project names, colors, and support emails.

Workflow

When asked to "Create a welcome email" or "Send a notification":

  1. Design: Create the .tsx file in src/emails/.
  2. Props: Define the interface for dynamic data.
  3. Implement: Build the UI using React Email components + Layout.
  4. Integrate: Add the sending logic in the relevant API route or function.