Skip to main content
Version: 0.24

Interface: EmailFlowConfig

Configuration for an email-based auth flow (verification or password reset).

Propertiesโ€‹

clientRouteโ€‹

clientRoute: string

Name of the route that handles the link sent in the email (e.g. "EmailVerificationRoute" or "PasswordResetRoute").

The route must be defined in App.spec with the route constructor.

This route should handle the process of taking a token from the URL and sending it to the server to verify the e-mail address. You can use our verifyEmail action and resetPassword action helpers for that.


getEmailContentFn?โ€‹

optional getEmailContentFn?: Reference<AnyFunction>

Function that returns the email content (subject, html, text) Wasp sends for this flow. Verification email functions receive { verificationLink }, and password reset email functions receive { passwordResetLink }. If omitted, Wasp uses a built-in default template.

In TypeScript, you can type the function with the GetVerificationEmailContentFn or GetPasswordResetEmailContentFn type from wasp/server/auth.

Exampleโ€‹

src/email.ts
import { GetVerificationEmailContentFn } from "wasp/server/auth"

export const getVerificationEmailContent: GetVerificationEmailContentFn = ({
verificationLink,
}) => ({
subject: "Verify your email",
text: `Click the link below to verify your email: ${verificationLink}`,
html: `
<p>Click the link below to verify your email</p>
<a href="${verificationLink}">Verify email</a>
`,
})