Skip to content

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

src/convex/auth.constants.ts

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:

  1. Looks up the address. If an account exists, it returns at once and the form continues to sign-in. Reoon isn’t called.
  2. If there is no account and validateEmails is on, it calls validateEmail from src/convex/model/emails/validateEmail.ts, which asks Reoon in quick mode. Only Reoon’s status valid passes.

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.

SituationThe user sees
Reoon doesn’t return validInvalid email
REOON_EMAIL_VERIFIER_TOKEN isn’t setEmail verification configuration missing
Reoon answers with an HTTP errorEmail verification service unavailable
The request throwsError 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.

src/convex/model/emails/validateEmail.ts

The email/convex registry item installs this file, so keep your version when you run jsrepo update email/convex.