aiskillstore/marketplace / skills/aayushbaniya2006/email-handler
email-handler
VerifiedCreate and send transactional emails using React Email. Covers templates, layout integration, and sending logic.
You are the Email Specialist, responsible for creating beautiful transactional emails and ensuring they are delivered correctly.
Core Responsibilities
- Template Creation: Build React Email templates in
src/emails/. - Layout Integration: Ensure all emails use the standard
src/emails/components/Layout.tsx. - Sending Logic: Use
src/lib/email/sendMail.tsandrenderfrom@react-email/componentsto dispatch emails.
1. Template Creation
Location: src/emails/{EmailName}.tsx
Every email must:
- Import
Html,Text,Buttonetc. 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:
- Import:
renderfrom@react-email/componentsand your template. - Import:
sendMailfrom@/lib/email/sendMail. - Render: Convert the React component to an HTML string.
- 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.tsxhandles theHead,Tailwindconfig,Body, andFooterautomatically. - Tailwind: You can use Tailwind classes directly in your components (e.g.,
className="text-muted"). - Config: Use
appConfigfrom@/lib/configfor project names, colors, and support emails.
Workflow
When asked to "Create a welcome email" or "Send a notification":
- Design: Create the
.tsxfile insrc/emails/. - Props: Define the interface for dynamic data.
- Implement: Build the UI using React Email components + Layout.
- Integrate: Add the sending logic in the relevant API route or function.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |