Validate emails
With validateEmails: true, the sign-in form checks a new email address with the Reoon Email Verifier before it lets someone sign up. A typo such as gmai.com or an inbox that doesn’t exist is stopped at the form, before it becomes an account that can’t be reached and before your emails to it bounce.
Validation sends no email. To send them, see Sending emails.
Turn it on
Create a Reoon account at emailverifier.reoon.com, generate a key under API Settings, and set it in Convex:
When validation runs
The email step of the sign-in form calls the Convex action checkEmailAvailabilityAndValidity in src/convex/users/actions.ts when the user continues. The action:
- Looks up the address. If an account exists, it returns at once and the form continues to sign-in. Reoon isn’t called.
- If there is no account and
validateEmailsis on, it callsvalidateEmailfromsrc/convex/model/emails/validateEmail.ts, which asks Reoon inquickmode. Only Reoon’s statusvalidpasses.
Nothing else validates: social sign-in, organization invitations, users created from the admin dashboard and email changes in the user profile skip the check.
When validation fails
The form shows the reason as an error and stays on the email step.
| Situation | The user sees |
|---|---|
Reoon doesn’t return valid | Invalid email |
REOON_EMAIL_VERIFIER_TOKEN isn’t set | Email verification configuration missing |
| Reoon answers with an HTTP error | Email verification service unavailable |
| The request throws | Error processing email verification |
Validation fails closed. While the token is missing or Reoon is down, nobody can sign up, although existing users still sign in. Set the token on every Convex deployment where validateEmails is on.
Use another verifier
Replace the body of validateEmail and keep its signature and return type. The action adds exists itself, and the form shows reason to the user.
The email/convex registry item installs this file, so keep your version when you run jsrepo update email/convex.
Related
- Configure features: every flag and environment variable.
- Sending emails: verification and the other auth emails.