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

Defaults plugin

Apply shared message and send-option defaults.

Use the defaults plugin when many sends need the same headers, tags, metadata, reply-to address, or idempotency key format.

Use it for

  • App or service headers.
  • Shared tags for routing or provider dashboards.
  • Hook metadata such as service, route, or template.
  • A default reply-to address.
  • Idempotency key prefixes.

Options

Option Writes to Override rule
headers message.headers Message headers win.
tags message.tags Message tags are appended after default tags.
metadata message.metadata Message metadata wins.
sendMetadata sendOptions.metadata Per-send metadata wins.
replyTo message.replyTo Used only when the message has no replyTo.
idempotencyKey Message and send options Used only when no idempotency key exists.
idempotencyKeyPrefix Message and send options Added only when the key does not already start with the prefix.

Override a default

Here, X-App: checkout wins over the default X-App: billing.

Stack defaults

Use custom IDs for multiple defaults layers.

Defaults run before adapter validation. If a default adds a field the selected adapter cannot represent, Email SDK throws before calling the provider.

Last updated on