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

Plugin API

Type reference for EmailPlugin and EmailSendMiddleware.

This page is the type reference. For examples, start with Writing plugins.

EmailPlugin

Field Notes
id Required stable plugin ID. Duplicate IDs throw.
adapters Providers to register. Duplicate adapter names throw.
hooks Observability callbacks that run before user hooks.
middleware Send-pipeline middleware.
extendClient Adds non-conflicting helper properties to the client.

createEmailClient is synchronous, so plugin adapter factories must return adapters synchronously.

EmailPluginContext

EmailSendMiddleware

beforeSend

Runs once per send call before message validation and before any adapter is called.

Thrown errors stop the send.

afterSend

Runs after a provider returns a normalized response.

Thrown errors are swallowed.

onError

Runs after a provider attempt fails.

Fallback adapters can still run after this callback. Thrown errors are swallowed.

Last updated on