import { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
const { data, error } = await resend.emails.send({
from: 'Acme <onboarding@resend.dev>',
to: ['delivered@resend.dev'],
subject: 'hello world',
html: '<p>it works!</p>',
replyTo: 'onboarding@resend.dev',
});
{
"id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794"
}
Start sending emails through the Resend Email API.
import { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
const { data, error } = await resend.emails.send({
from: 'Acme <onboarding@resend.dev>',
to: ['delivered@resend.dev'],
subject: 'hello world',
html: '<p>it works!</p>',
replyTo: 'onboarding@resend.dev',
});
{
"id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794"
}
"Your Name <sender@domain.com>".Hide properties
template object with:id: the id or the alias of the published templatevariables: an object with a key for each variable (if applicable)template is provided, you cannot send html, text, or react in the payload, otherwise the API will return a validation error.When sending a template, the payload for from, subject, and reply_to take precedence over the template’s defaults for these fields. If the template does not provide a default value for these fields, you must provide them in the payload.template is provided. Only published templates can be used when sending emails.variables: {
CTA: 'Sign up now',
CTA_LINK: 'https://example.com/signup'
}
Hide properties
FIRST_NAME, LAST_NAME, EMAIL, UNSUBSCRIBE_URL.It can contain no more than 50 characters.string: maximum length of 2,000 charactersnumber: not greater than 2^53 - 1import { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
const { data, error } = await resend.emails.send({
from: 'Acme <onboarding@resend.dev>',
to: ['delivered@resend.dev'],
subject: 'hello world',
html: '<p>it works!</p>',
replyTo: 'onboarding@resend.dev',
});
{
"id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794"
}
Was this page helpful?