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:
How the token is delivered.
"code"— user receives a token to type into your app"link"— user receives a clickable button that verifies automatically
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.
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).
URL to redirect to after link verification. Only valid with
mode: "link". On success it receives verified=true in its query string; an invalid or expired link shows Sublay’s hosted error page instead.
