Overview
createEmailTemplates returns a set of pre-built HTML email templates for every auth flow KavachOS supports. Each template produces a { subject, text, html } object you pass directly to your mail provider.
Setup
Built-in templates
Using a template
Every template is a function that accepts the variables it needs and returns{ subject, text, html }.
All template signatures
Integrating with auth plugins
Auth plugins expose callbacks likeonSendVerification and onSendMagicLink. Pass template output directly into them.
- Magic link
- Email OTP
- Password reset
Customizing templates
Override any template by passing your own function. Custom templates receive the same arguments as built-ins and must return{ subject, text, html }.
Overrides only replace the templates you provide. All other templates continue to use the defaults.
Next steps
Magic link
Passwordless auth via email links.
Email OTP
One-time passcodes delivered by email.
Internationalization
Translate email subjects and error messages.