Many sign-up forms refuse addresses on domains known for throwaway mail. The check might be a list in your code, a package such as a disposable-domains list, a setting in your auth provider, or an email-checking service your form calls. Proxy Mail QA’s domains can end up on those lists, because anyone can create an address on them.
Keep the block, add an allowlist for test environments
The block does its job in production. What you need is a short list of domains that skip it, read from an environment variable that only development and staging set:
// Read once at start-up. Unset in production, so the list is empty there.
const TEST_DOMAINS = (process.env.ALLOW_TEST_EMAIL_DOMAINS ?? '')
.split(',')
.map((domain) => domain.trim().toLowerCase())
.filter(Boolean);
export function isBlockedDomain(email: string, blocked: Set<string>): boolean {
const domain = email.split('@').pop()?.toLowerCase() ?? '';
if (TEST_DOMAINS.includes(domain)) return false;
return blocked.has(domain);
}
Then, in development and staging only:
ALLOW_TEST_EMAIL_DOMAINS=mailclub.dev,enable.li,valida.te.it
- Name the domains, not a pattern. Allow exactly the domains you test with, never
*.devor every domain with a dot. - Read it on the server. A check that runs only in the browser is skipped by anyone who posts the form directly, in production too.
- Fail closed. If the variable is missing, the list is empty and the block applies, so a missing setting can’t open production up.
If the block is in a service you call
Email-checking services and auth providers usually have their own allowlist. Add our domains there in the development or staging project only, if the provider keeps them apart. Where one setting covers every environment, keep the service’s check off in development and staging and on in production, or skip the call when the environment variable above lists the domain.
Check what the user sees
While you’re here, test the block itself:
- An address on a blocked domain is refused with a message that says what to do (“Use your work or personal email address”), not a generic error.
- The refusal happens before the account is made, so no half-created user is left behind.
- A real person’s address with a + tag (
name+news@example.org) still gets through, unless you decided to refuse those too.
For the form’s own validation, the unusual but valid addresses cover capitals, + tags and a domain with three parts.