Email Templates

Email templates server

Send or render an email template from server code, with typed template names and props.

This page shows how server code sends and renders templates, for app developers. Set up the module first: Overview.

Send a template

sendEmailTemplate renders a template and sends it through Notify. Both functions are auto-imported in server code.

await sendEmailTemplate('welcome', { name: user.name, url }, {
  to: user.email,
  replyTo: 'support@frigear.nu',
})
FunctionSignature
sendEmailTemplate(name, props, message) => Promise<void>
renderEmailTemplate(name, props, { locale?, text? }) => Promise<{ subject?, body, text? }>. Renders without sending.

message is an EmailNotification without its body (to, replyTo, meta), plus:

FieldPurpose
subjectOverrides the template's <ESubject>. Required when the template has none.
textYour own plain-text body, or false to send HTML only. By default it is rendered from the template.
localeThe locale to render with, when @nuxtjs/i18n is installed.

Names and props are typed in .nuxt/types/email-templates.d.ts, so a misspelled name or a missing prop does not compile. Dev regenerates the types when you add or remove a template.

Bundle and runtime notes

Rendering adds Vue server rendering and every template, including those published modules ship, to the Nitro server bundle.

This does not work with experimental.nitroViteEnvironment yet. The module adds module templates to the renderer's #email-templates, but in that mode the renderer only compiles .vue files from the layer folders.

Next steps

  • Module emails – the templates modules ship, and their props.
  • Notify – choose the service that delivers the email.
Copyright © 2026