Overview
useSendVerificationEmail returns a function that sends a verification email to the currently authenticated user. The token expires after 5 minutes. Calling it on an already-verified user is a no-op (returns { success: true } without sending).
Usage Example
Parameters
The returned function requires a props object —mode is always required, and which other fields are required depends on it:
"code" | "link"
required
How the token is delivered.
"code"— user receives a token to type into your app"link"— user receives a clickable button that verifies automatically
"hex" | "numeric" | "alpha" | "alphanumeric"
Character set for the token.
- Required when
mode: "code"— there’s no default, since"hex"(see below) produces something no one would want to type. - Optional when
mode: "link"(defaults to"hex") — the token is embedded in a URL, never read by a human, so the format doesn’t matter.
number
Length of the generated token (4–12).
- Required when
mode: "code"andtokenFormatis"numeric","alpha", or"alphanumeric". - Not allowed when
tokenFormatis"hex"— hex ignores length and always produces a fixed 64-character token, so specifying one would be silently meaningless. - Optional when
mode: "link"(defaults to6).
string
URL to redirect to after link verification. Only valid with
mode: "link". Receives ?verified=true or ?verified=false&error=... as query params.Returns
The hook returns an async function. That function resolves to:boolean
true when the request completes without a server error.
