Skip to content
emailkit
Esc
navigateopen⌘Jpreview
On this page

email.onAll

Every email event in one stream — runs before the specific hooks.

Fires for every email event, before its specific hook runs. type says which event it is, data holds that event’s payload, and emailDriver names the driver that produced it. Built for logging, metrics, and one-table event stores.

hooks: {
  email: {
    onAll: async (event) => {
      await prisma.emailEvent.create({
        data: {
          type: event.type,
          emailDriver: event.emailDriver,
          payload: event.data,
        },
      });
    },
  },
},

context is set only for sync-replayed events — see Sync & recovery.

Payload

PropType
emailDriver?string

EmailKit driver id that produced this event

Typestring
type| "inbound" | "outbound" | "delivered" | "opened" | "clicked" | "bounced" | "complained" | "rejected" | "unknown"

Which email event this is

Type| "inbound" | "outbound" | "delivered" | "opened" | "clicked" | "bounced" | "complained" | "rejected" | "unknown"
dataunknown

The event payload, shaped by `type`

Typeunknown
raw?unknown

Provider-specific raw data (for debugging or advanced use cases)

Typeunknown
context?unknown

User round-trip data from `SyncInput.context`, set only for sync-replayed events.

Typeunknown

Last updated on July 24, 2026

Was this page helpful?