Sending modes
Pick the right method for batches, personalization, schedules, and idempotency.
Email SDK separates independent messages from one message personalized across recipients.
Independent sends
Use sendMany when every item is a complete message with its own outcome. By default items send one at a time in input order. Pass concurrency to send several at once; results still come back in input order:
const results = await email.sendMany(items, { concurrency: 5 });
Each item is its own provider request, so keep concurrency within your provider’s rate limit.
const results = await email.sendMany([
{ message: welcomeMessage, options: { idempotencyKey: "welcome:1" } },
{ message: receiptMessage, options: { idempotencyKey: "receipt:1" } },
]);
The method returns one settled result per item. Item options override method-level options; retry and fallback merge one level deep, so an item’s fallback.adapters replaces the method’s list while keeping method-level onUnknownDelivery.
Personalized recipients
Use sendPersonalized when subject or body tokens vary by recipient.
const result = await email.sendPersonalized(
{
message: {
from: "Acme <hello@acme.com>",
subject: "Hi %recipient.name%",
text: "Welcome, %recipient.name%.",
},
recipients: [
{ to: "ada@example.com", variables: { name: "Ada" } },
{ to: "linus@example.com", variables: { name: "Linus" } },
],
},
{ idempotencyKey: "campaign:42", idempotency: "best-effort" },
);
Mailgun and SendGrid use native personalized APIs. Other built-in adapters expand recipients into deterministic sequential sends. At least one accepted recipient resolves with accepted and rejected; zero accepted recipients throws EmailAllRecipientsFailedError.
Scheduled sends
sendAt accepts a Date or RFC 3339 string with Z or a numeric offset.
await email.send({
...message,
sendAt: "2026-08-01T09:00:00Z",
});
The SDK does not wait or queue. Capable adapters translate the timestamp into the provider’s scheduling field. Incapable adapters reject it during validation.
Idempotency
Pass idempotencyKey in send options, not in EmailMessage.
await email.send(receipt, {
idempotencyKey: "receipt:order_123",
});
Resend, JetEmail, Lettermint, Primitive, SendHeron, Helo, and Nightmail (unreleased, ships in the next release) have native idempotency support. SMTP derives Message-ID from the key. Every other built-in adapter reports capabilities.idempotency: "none", so a send with idempotencyKey on a route that includes one of them fails with EmailValidationError before any request. That check also covers fallback adapters.
When the key is for your own bookkeeping, or another layer such as a queue or outbox already deduplicates, pass idempotency: "best-effort". The send goes through, and adapters that support the key still receive it:
await email.send(receipt, {
adapter: "sendgrid",
idempotencyKey: "receipt:order_123",
idempotency: "best-effort",
});
Message reference
See exact message, attachment, header, and schedule types.
Capability groups
Choose adapters that support the sending mode you need.