Skip to content
Email SDK
Esc
↑↓navigate↵open⌘Jpreview
On this page

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:

Each item is its own provider request, so keep concurrency within your provider’s rate limit.

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.

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.

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.

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:

Message reference

See exact message, attachment, header, and schedule types.

Capability groups

Choose adapters that support the sending mode you need.

Last updated on