Skip to content
You're viewing documentation for v2.0.0. It may be out of date.Go to latest
Email SDK
Esc
↑↓navigate↵open⌘Jpreview
On this page

Routing plugin

Select a registered adapter from the prepared message and send options before route validation.

routingPlugin centralizes application routing rules without hiding fallback behavior inside an adapter.

The selector may be async. Returning undefined preserves the caller’s adapter choice or the client default. Returning a name sets the primary adapter; normal retry, validation, and fallback rules still apply.

Keep rules deterministic

Route from data already present in the message or send metadata. Avoid network calls in the selector because they delay every send and can fail as EmailMiddlewareError before provider validation.

A routing plugin does not register adapters. Every returned name must already exist on the client.

Delivery capabilities

Make sure every selected route preserves the required behavior.

Fallback and retries

Understand what happens after the primary route fails.

Last updated on