- Associate the email a “customer ID” from your application
- Add a label from your database like “free” or “enterprise”
- Note the category of email sent, like “welcome” or “password reset”
Add unique identifiers to emails sent.
POST /emails endpointimport { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
await resend.emails.send({
from: 'Acme <onboarding@resend.dev>',
to: ['delivered@resend.dev'],
subject: 'hello world',
html: '<p>it works!</p>',
tags: [
{
name: 'category',
value: 'confirm_email',
},
],
});
POST /emails/batch endpointimport { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
const { data, error } = await resend.batch.send([
{
from: 'Acme <onboarding@resend.dev>',
to: ['foo@gmail.com'],
subject: 'hello world',
html: '<h1>it works!</h1>',
tags: [
{
name: 'category',
value: 'confirm_email',
},
],
},
{
from: 'Acme <onboarding@resend.dev>',
to: ['bar@outlook.com'],
subject: 'world hello',
html: '<p>it works!</p>',
tags: [
{
name: 'category',
value: 'confirm_email',
},
],
},
]);
Was this page helpful?