Skip to main content

Type Alias: EmailContext

type EmailContext: object;

Contextual data passed to every email template or builder, enabling personalized content and conditional workflows.

Type declaration

appName

appName: string;

Application display name from config (defaults to "Robo.js").

optional links: object;

Pre-built absolute URLs for verification or password reset actions.

links.resetPassword?

optional resetPassword: string;

links.verifyEmail?

optional verifyEmail: string;

request?

optional request: object;

Request metadata such as origin/base URL used to build links. May be undefined when the request context is not available (e.g. background jobs).

request.origin?

optional origin: string | null;

session?

optional session: object;

Session metadata present for the session:created event.

session.id?

optional id: string | null;

session.ip?

optional ip: string | null;

session.userAgent?

optional userAgent: string | null;

tokens?

optional tokens: object;

Raw tokens for verification/reset flows (use links for user-facing URLs).

tokens.resetPassword?

optional resetPassword: string;

tokens.verifyEmail?

optional verifyEmail: string;

user

user: object;

Adapter user record (email/name may be null for certain providers).

user.email?

optional email: string | null;

user.id

id: string;

user.name?

optional name: string | null;

Example

const greeting = `Hi ${ctx.user.name ?? 'there'}`
const auditNote = ctx.session?.ip ? `IP ${ctx.session.ip}` : 'No session data'