Actions
Send Email

Resend.com is currently in private beta but you can request early access here.

If you’d like to render emails using React, please see the React.email docs

Params

keyrequired
string

A unique string. Please see the Keys and Resumability doc for more info.

messagerequired
object
text
string

The text of the email. If html is provided, this will be used as the plain text version of the email.

html
string

The HTML of the email. If text is provided, this will be used as the HTML version of the email.

react
react component

A React component that will be rendered to HTML and used as the email content. Please see the React.email docs for more info

subjectrequired
string

The subject of the email.

fromrequired
string

The email address of the sender.

torequired
string | string[]

One or more email addresses of the recipients.

cc
string | string[]

One or more email addresses of the CC recipients.

bcc
string | string[]

One or more email addresses of the BCC recipients.

replyTo
string | string[]

An optional email address to use as the reply-to address.

Response

id
string

The ID of the email.

from
string

The email address of the sender.

to
string

The email address of the recipient.

created_at
string

The date and time the email was created.

Example Workflows

import * as github from "@trigger.dev/github";
import * as resend from "@trigger.dev/resend";
import { CriticalIssueEmail } from "./emails";

new Trigger({
  id: "email-ops",
  name: "On Critical Issue",
  on: github.events.issueEvent({
    repo: "triggerdotdev/trigger.dev",
  }),
  run: async (event, ctx) => {
    if (event.action === "labeled" && event.label.name === "critical") {
      await resend.sendEmail("🚨 Alert Ops", {
        to: "ops@trigger.dev",
        from: "internal@trigger.dev",
        subject: `Critical issue: ${event.issue.title}`,
        react: (
          <CriticalIssueEmail
            issue={event.issue}
            sender={event.sender}
            repo={event.repository}
          />
        ),
      });
    }
  },
}).listen();

Example Response

{
  "id": "1673618429",
  "from": "internal@trigger.dev",
  "to": "ops@trigger.dev",
  "created_at": "2023-01-24T14:38:26Z"
}