- 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 { Emailr } from 'emailr';
const emailr = new Emailr('em_xxxxxxxxx');
await emailr.emails.send({
from: 'Acme <[email protected]>',
to: ['[email protected]'],
subject: 'hello world',
html: '<p>it works!</p>',
tags: [
{
name: 'category',
value: 'confirm_email',
},
],
});
POST /emails/batch endpointimport { Emailr } from 'emailr';
const emailr = new Emailr('em_xxxxxxxxx');
const { data, error } = await emailr.batch.send([
{
from: 'Acme <[email protected]>',
to: ['[email protected]'],
subject: 'hello world',
html: '<h1>it works!</h1>',
tags: [
{
name: 'category',
value: 'confirm_email',
},
],
},
{
from: 'Acme <[email protected]>',
to: ['[email protected]'],
subject: 'world hello',
html: '<p>it works!</p>',
tags: [
{
name: 'category',
value: 'confirm_email',
},
],
},
]);