Integrations · Sign-up and auth

Stop bad emails at Auth0 sign-up

An Auth0 Action that checks the email address of every new sign-up and stops the sign-ups whose address you do not want: by default addresses that cannot receive mail (invalid) and throwaway inboxes (disposable). It runs on Auth0's Pre User Registration trigger, before the user is created. If the check cannot be made, because our API is slow, unreachable or answers with an error, the sign-up goes through as if the Action were not there.

There is nothing to install from a marketplace: you paste one file into your Auth0 tenant. Download it: email-validation.js.

What gets checked

Sign-ups through Database and Passwordless connections: Auth0 runs Pre User Registration only for those. Sign-ins through Google, other social connections or enterprise connections are not checked, and nor is a passwordless sign-up by phone number, which has no email address.

Set it up

  1. Create an API key on the API keys page with the permission Validate addresses and a daily credit cap.
  2. In the Auth0 dashboard, open Actions → Library, choose Create Action → Build from scratch, give it a name, pick the trigger Pre User Registration and the runtime Node 22.
  3. Replace the code in the editor with the whole of email-validation.js: copy it from the box below.
  4. Open Secrets (the key icon in the editor) and add EV_API_KEY with your key. Add the optional secrets below if you need them. Select Deploy.
  5. Open Actions → Triggers (Flows on some dashboards) → pre-user-registration, drag the Action into the flow and select Apply.
  6. Try it in the editor's Test panel, which runs the Action without creating a user, so no mail is sent. Set the event's user.email to no_mailbox@sandbox.email-validation.org and select Run: the Action denies the sign-up. With accepted@sandbox.email-validation.org it does not. Then, once the Action is in the flow, sign up on a Database connection with no_mailbox@sandbox.email-validation.org: the sign-up is stopped. Never sign up with a test address that goes through. Auth0 would send its verification email to it, and that mail would bounce, which hurts the reputation of whoever sends it. Test addresses return the result their name says, cost nothing and contact no mail server.

The Action's code

Or open email-validation.js as plain text in a new tab, select all of it and copy it from there.

Settings

All settings are secrets of the Action, so your key never sits in the code.

SecretValue
EV_API_KEYRequired. Your API key.
EV_REGIONeu sends the checks to our EU host, for EU data residency. Leave it out for the US host. Both use the same keys and credits.
EV_STOP_STATUSESThe statuses that stop a sign-up, separated by commas, from valid, invalid, catch_all, unknown and disposable. Leave it out for invalid,disposable. none stops nothing and only writes each result to the Action's logs, a way to see what it would do first.
EV_DENY_MESSAGEThe message the person signing up sees when they are stopped. Leave it out for ours (below).

Stopping more than the default turns away more real people: a catch_all domain accepts mail for every address, so the mailbox may well exist, and an unknown result means the mail server did not let us check. An unknown result caused by our own side (reason timeout or internal_error) never stops a sign-up, whatever you choose.

A result marked disposable is stopped while disposable is on the list, whatever its status (the API keeps invalid or unknown as the status of some addresses on disposable domains), except an unknown that means our check ran out of time or failed (timeout, internal_error).

What the person sees

The sign-up stops, and Auth0 hands the sign-up form this message to show the person:

StatusMessage
invalidThis email address cannot receive email. Please check it or use another address. When our API suggests a correction, it adds: Did you mean …?
disposable, or a valid or unknown result marked disposablePlease sign up with a permanent email address, not a disposable one.
any other you chosePlease sign up with a different email address.

Your tenant logs show the status, our reason and the request id for each stopped sign-up.

When the check cannot be made

The Action waits at most 6 seconds for an answer (Auth0 allows the whole trigger 20 seconds), and asks our API to answer within 5. With no answer in time, a network error, a wrong or missing key, no credits left, a rate limit or any other error, the sign-up goes through and the Action writes one line to its logs with the reason, never the address. The Action never resends a check, so a sign-up is never held up longer than that. After a rate limit or a busy answer (HTTP 429 or 503), this Action instance sends no check for the time our API asks (30 seconds if it names none, at most 5 minutes); sign-ups in that time are not checked.

What it costs

Each check costs at most 1 credit, as with any validation request; unknown results, errors and test addresses are free. The same person trying again with the same address is checked again, and a repeat check also costs 1 credit. Credits come in one-time packs, as little as $0.15 per 1,000 with the 50,000,000-credit pack (smaller packs cost more per credit), and new accounts get 500 free credits (100 when you sign up with a free email provider such as Gmail, Outlook or Yahoo, another personal mailbox such as a paid one like Fastmail or one from your internet provider, or an address from a relay or alias service). The key's daily credit cap bounds what a burst of sign-ups can spend; once it is reached, sign-ups go through unchecked until the cap resets.

What we receive

The Action sends only the email address, to our US or EU host. Not the person's name, IP address or anything else from Auth0.

More on Auth0

Updated · Maintained by: Email Validation LLC

Need help? Contact support, or ask the help chat. Something wrong or missing on this page? Tell us