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";
14
const resend = new Resend({
16
apiKey: process.env.RESEND_API_KEY!,
23
padding: "20px 0 48px",
33
border: "solid 1px #dedede",
35
textAlign: "center" as const,
40
textAlign: "left" as const,
46
backgroundColor: "#28a745",
49
borderRadius: "0.2em",
50
textAlign: "center" as const,
53
function BasicEmail({ name, text }: { name: string; text: string }) {
57
<Preview>Welcome to Acme Inc!</Preview>
58
<Container style={container}>
59
<Section style={section}>
60
<Text>Hey {name}!</Text>
62
<Button style={button} pY={4} pX={4} href="https://acmecompany.inc/">
73
id: "resend-send-react-email",
74
name: "Resend: send react email",
76
trigger: eventTrigger({
90
run: async (payload, io, ctx) => {
91
await io.resend.sendEmail("send-email", {
93
subject: payload.subject,
97
react: <BasicEmail name={payload.name} text={payload.text} />,