Email Templates

Module emails

How a module ships an email template, and how your app replaces it with a file of the same name.

This page shows how a module ships an email template (for module authors) and how your app replaces one (for app developers). Set up the module first: Overview.

Shipping a template from a module

A module sends its email as before, with plain HTML as the fallback, and names its template:

await dispatchEmailNotification({
  to,
  subject: 'Your sign-in link',
  body: `<p>…</p>`,
  text: `…`,
  template: { name: 'auth-magic-link', props: { name, url } },
})

The module registers its template folder with Notify's notify:email:templates build hook, so it never depends on Email Templates:

src/module.ts
// in setup()
nuxt.hook('notify:email:templates', sources => sources.push({ dir: resolver.resolve('./runtime/emails') }))

Name module templates <module>-<email>.vue, so they never collide.

Email Templates renders the named template on Notify's notify:email hook. It replaces subject (when the template has <ESubject>), body and text.

Without that template, the fallback is sent. A template that throws or renders nothing is logged, and the fallback is sent too.

Overriding a module template

Add a template with the same name to your app, or to any layer, and it replaces the module's. Use the same props, and the components to keep the look. To change only the branding, use the options.

app/emails/auth-magic-link.vue
<script setup lang="ts">
import { EmailButton, EmailHeading, EmailLayout, EmailLinkFallback, EmailText } from '@frigear-nu/email-templates/components'

defineProps<{ name: string, url: string }>()
</script>

<template>
  <EmailLayout lang="da" preview="Dit login-link">
    <ESubject>Log ind på Frigear</ESubject>
    <EmailHeading>Hej {{ name }}</EmailHeading>
    <EmailText>Klik på knappen for at logge ind.</EmailText>
    <EmailButton :href="url">Log ind</EmailButton>
    <EmailLinkFallback :href="url">Eller kopier linket:</EmailLinkFallback>
  </EmailLayout>
</template>

Your app's templates win over the layers' templates, which win over the modules' templates.

Templates modules ship

Override any of these by its name.

TemplateSent byProps
auth-magic-linkAuth: magic-link sign-in{ name, url }
auth-verify-emailAuth: verify the address after registering{ name, url }
auth-password-resetAuth: forgot password{ url }
users-verify-email-changeUsers: confirm a new email address{ name, url }
users-email-changedUsers: notice to the old address, with an undo link{ name, newEmail, url }
users-password-changedUsers: password changed notice{ name }
subscriptions-payment-linkSubscriptions: staff-sent payment link{ name, label, url }

Next steps

Copyright © 2026