Email Frontmatter

Define subject lines, recipients, metadata, and delivery defaults directly in the Markdown email file.

Frontmatter holds email metadata. Use it for message-level settings such as subject, preheader, recipients, headers, and delivery defaults. Keep the rendered structure in the Markdown body and keep input validation in the embedded schema block.

Minimal example

welcome.md
---
subject: "Welcome {{ name }}"
preheader: Finish setting up your account
layout: transactional
---

# Welcome, {{ name }}

Frontmatter is optional, but most emails will set at least subject.

Supported keys

KeyUse it for
subjectMessage subject. Supports interpolation.
preheaderInbox preview text.
layoutSelect a named email layout.
localeAttach locale metadata to the message. When you use email i18n, the locale folder controls variant selection and this field stays message metadata.
categoryClassify the email for app-level grouping.
fromOverride the default sender for this email.
replyToSet the reply-to address.
headersAttach custom message headers.
metadataAttach provider-portable metadata.
deliverySet provider-level delivery options.
envelopeDefine default recipients and envelope fields.
textOverride the generated plain-text body.

Recipient defaults

Use envelope when the email definition itself should carry defaults for to, cc, bcc, or related envelope values.

envelope:
  to:
    - max@example.com
  cc:
    - team@example.com

Send-time options can still override these values when you call sendEmail(...).

Message metadata

Use frontmatter for stable metadata that belongs to the email definition itself.

subject: "Invoice {{ invoiceNumber }}"
headers:
  X-Customer-Tier: enterprise
metadata:
  campaign: billing
  flow: invoice-reminder

Use the Markdown body for content and the embedded schema block for validation.

For locale-specific files, ICU formatting, and Nuxt request-locale reuse, see Email i18n.

Delivery settings

Put shared delivery defaults in delivery when the provider mapping should travel with the email definition.

delivery:
  labels:
    - onboarding
  template:
    key: welcome-template

Provider pages describe how those shared fields map onto Resend, SendGrid, and Postmark.

  • Frontmatter: message metadata and default delivery settings.
  • Embedded schema block: input validation and TypeScript inference.
  • Embedded CSS block: author-authored styles that should be inlined into the final email HTML.
  • Markdown body: email structure and content.

For the validation flow, see Input Schemas.