High-performance email validation library to detect disposable emails, verify mail capability, and estimate inbox delivery likelihood.
High-performance email validation library to detect disposable emails, verify mail capability, and estimate inbox delivery likelihood.
Maintained by Morgan Miller / StackVerify. Works in Node.js, TypeScript, ESM, and JavaScript environments.
---
- Syntax validation – ensures email is properly formatted
- Disposable email detection – identifies temporary or throwaway emails
- Domain & MX check – ensures the domain can receive emails (Node.js only)
- Inbox likelihood scoring – estimates likelihood of reaching inbox
- Fast lookups – supports large disposable domain lists efficiently
- Browser + Node safe – auto-detects environment
---
``bash`
npm install @stackverify/email-check`or
`
yarn add @stackverify/email-check`
Usage
ESM / TypeScript
Copy code
Ts
import { checkEmail } from "@stackverify/email-check";
async function validateEmail(email: string) {
const result = await checkEmail(email);
if (!result.isValid) {
console.log(Email is invalid: ${result.reason});
// Handle invalid email:
// - Show error to user
// - Ask for a different email
// - Log or reject in backend
return;
}
if (result.disposable) {
console.log("Email is disposable. Request a permanent email.");
return;
}
if (result.inbox.score < 80) {
console.log("Email may not reach inbox reliably.");
// Optional: warn user or request alternate email
}
console.log("Email is valid and likely to reach inbox.");
}
validateEmail("user@gmail.com");
``
CommonJS (Node.js)
Copy code
Js
const { checkEmail } = require("@stackverify/email-check");
checkEmail("user@gmail.com").then(result => {
if (!result.isValid) {
console.log(Invalid email: ${result.reason});
return;
}
if (result.disposable) {
console.log("Disposable email detected.");
return;
}
if (result.inbox.score < 80) {
console.log("Email might not reach inbox.");
}
console.log("Email is valid and likely to reach inbox.");
});
`{ score: 0-100, label: 'low'Result Object
Property
- Type
- Description
- isValid
- boolean
- True if email passes all checks
syntax
- boolean
- True if email syntax is valid
disposable
- boolean
- True if email is disposable
domainExists
- boolean
- True if domain exists (Node.js only)
hasMX
- boolean
- True if domain has MX records (Node.js only)
inbox
- object
-
reason
- string|null
- Reason if invalid
import { checkEmail } from "@stackverify/email-check";const emails = ["test@gmail.com", "temp@0815.ru", "user@nonexistentdomain.xyz"];
for (const email of emails) {
const result = await checkEmail(email);
if (!result.isValid || result.disposable || result.inbox.score < 80) {
console.log(
${email} is invalid or risky: ${result.reason || 'low inbox score'});
continue;
} console.log(
${email} is valid and likely to reach inbox.);
}
``