tempsanitizer
v1.0.0
Published
Check email domain validity, risk score, and MX records
Maintainers
Readme
Tempsanitizer
Verify email domains — validate deliverability, assess risk, detect disposable and temporary email addresses, and inspect MX records.
Features
- Domain validity check (accept/reject for sign-ups)
- Risk scoring (0–100)
- Disposable & temporary email detection
- MX host & IP resolution
- Email provider identification
- Domain age lookup
- Possible typo suggestions
Install
npm install tempsanitizerUsage
const checkDomain = require("tempsanitizer");
// Valid domain
const result = await checkDomain("gmail.com");
console.log(result.valid); // true
console.log(result.risk); // 8
console.log(result.mx_host); // gmail-smtp-in.l.google.com
// Disposable domain
const disposable = await checkDomain("mailinator.com");
console.log(disposable.is_disposable); // true
// Invalid domain
const invalid = await checkDomain("nonexistentxyz123.com");
console.log(invalid.valid); // falseAPI
checkDomain(domain)
| Parameter | Type | Description |
|-----------|------|-------------|
| domain | string | The domain name to check (e.g. "gmail.com") |
Returns a Promise that resolves to a result object.
Response Fields
| Field | Type | Description |
|-------|------|-------------|
| valid | boolean | Whether the domain is safe to accept for sign-ups |
| block | boolean | Whether the domain is explicitly blocked |
| domain | string | The queried domain |
| base_domain | string | Root domain extracted |
| text | string | Human-readable verdict |
| reason | string | Reason for the verdict |
| risk | number | Risk score from 0 (safe) to 100 (high risk) |
| is_disposable | boolean | True if domain offers temporary/disposable emails |
| is_email_forwarder | boolean | True if domain is an email forwarding service |
| is_public_free | boolean | True if domain is a public free email provider |
| is_public_premium | boolean | True if domain is a premium email provider |
| is_business_provider | boolean | True if domain is a business email provider |
| is_isp_email | boolean | True if domain is an ISP-provided email |
| is_email_api | boolean | True if domain is an email API service |
| is_web_hosting_email | boolean | True if domain is a web hosting email |
| is_self_hosted | boolean | True if domain is self-hosted email |
| is_parked | boolean | True if domain appears parked |
| is_role_based_email | boolean | True if domain suggests role-based addressing |
| mx_host | string | Primary MX hostname |
| mx_ip | string | Primary MX IP address |
| mx_info | string | MX resolution details |
| mx_fallback | boolean | Whether fallback MX was used |
| mx_hosts | string[] | All MX hostnames |
| mx_ips | string[] | All MX IP addresses |
| mx_priorities | object | MX priority mapping |
| email_provider | string | Identified email provider name |
| disposable_provider | string | Identified disposable provider name |
| possible_typo | string[] | Suggested typo corrections |
| domain_age_days | number | Age of the domain in days |
| domain_created_at | string | Domain creation date (ISO 8601) |
| block_status_changed_at | string | Last block status change date |
Error Handling
On failure, the function returns an object with an error field instead of throwing:
const result = await checkDomain("");
console.log(result.error); // "Request failed with status code 400"Examples
Check before sign-up
async function allowSignup(email) {
const domain = email.split("@")[1];
const { valid, is_disposable, risk } = await checkDomain(domain);
return valid && !is_disposable && risk < 30;
}Get full domain intelligence
const info = await checkDomain("outlook.com");
console.log(`Provider: ${info.email_provider}`);
console.log(`Age: ${info.domain_age_days} days`);
console.log(`MX: ${info.mx_host} (${info.mx_ip})`);License
ISC
