1
import { TriggerClient, eventTrigger } from "@trigger.dev/sdk";
2
import { Resend } from "@trigger.dev/resend";
3
import { z } from "zod";
6
import { Html } from "@react-email/html";
7
import { Head } from "@react-email/head";
8
import { Text } from "@react-email/text";
9
import { Button } from "@react-email/button";
10
import { Section } from "@react-email/section";
11
import { Preview } from "@react-email/preview";
12
import { Container } from "@react-email/container";
13
const resend = new Resend({
15
apiKey: process.env.RESEND_API_KEY!,
22
padding: "20px 0 48px",
32
border: "solid 1px #dedede",
34
textAlign: "center" as const,
39
textAlign: "left" as const,
45
backgroundColor: "#28a745",
48
borderRadius: "0.2em",
49
textAlign: "center" as const,
52
function BasicEmail({ name, text }: { name: string; text: string }) {
56
<Preview>Welcome to Acme Inc!</Preview>
57
<Container style={container}>
58
<Section style={section}>
59
<Text>Hey {name}!</Text>
61
<Button style={button} pY={4} pX={4} href="https://acmecompany.inc/">
72
id: "resend-send-react-email",
73
name: "Resend: send react email",
75
trigger: eventTrigger({
89
run: async (payload, io, ctx) => {
90
await io.resend.sendEmail("send-email", {
92
subject: payload.subject,
96
react: <BasicEmail name={payload.name} text={payload.text} />,