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

Plugin API

Exact plugin context, hooks, middleware, adapter registration, and typed client extension contracts.

EmailPlugin

Plugin ids are unique. Adapter registration and client extensions run synchronously during construction.

Plugin context

addAdapter rejects duplicate route names.

Hooks

Hook exceptions are swallowed. Use them only for best-effort observation.

Middleware

beforeSend may replace the message and/or send options. Middleware exceptions become EmailMiddlewareError with a phase.

Multiple beforeSend middleware entries run in order. Replacement options shallowly merge into the current options.

Client extensions

extendClient returns an object merged into the client. The resulting extension type is the intersection of every plugin extension.

Reserved-key collisions throw EmailValidationError during construction.

Create a plugin

Build a typed middleware and extension example.

Last updated on