import { Resend } from 'resend';

const resend = new Resend('re_123456789');

await resend.emails.send({
  from: 'Acme <onboarding@resend.dev>',
  to: ['delivered@resend.dev'],
  subject: 'hello world',
  text: 'it works!',
  attachments: [
    {
      filename: 'invoice.pdf',
      content: invoiceBuffer,
    },
  ],
  headers: {
    'X-Entity-Ref-ID': '123456789',
  },
  tags: [
    {
      name: 'category',
      value: 'confirm_email',
    },
  ],
});
{
  "id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794"
}

Body Parameters

from
string
required

Sender email address.

To include a friendly name, use the format "Your Name <sender@domain.com>".

to
string | string[]
required

Recipient email address. For multiple addresses, send as an array of strings. Max 50.

subject
string
required

Email subject.

bcc
string | string[]

Bcc recipient email address. For multiple addresses, send as an array of strings.

cc
string | string[]

Cc recipient email address. For multiple addresses, send as an array of strings.

reply_to
string | string[]

Reply-to email address. For multiple addresses, send as an array of strings.

html
string

The HTML version of the message.

text
string

The plain text version of the message.

react
string

The React component used to write the message. Only available in the Node.js SDK.

headers
object

Custom headers to add to the email.

attachments
array

Filename and content of attachments (max 40mb per email)

content
buffer | string

Content of an attached file.

filename
string

Name of attached file.

path
string

Path where the attachment file is hosted

tags
array

Email tags

name
string
required

The name of the email tag.

It can only contain ASCII letters (a–z, A–Z), numbers (0–9), underscores (_), or dashes (-).

It can contain no more than 256 characters.

value
string

The value of the email tag.

It can only contain ASCII letters (a–z, A–Z), numbers (0–9), underscores (_), or dashes (-).

It can contain no more than 256 characters.