npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ejekanshjain/simple-email-validator

v1.0.3

Published

A simple email validator utility.

Readme

Simple Email Validator

A brutally honest, no-bullshit TypeScript email validation library that doesn’t just check if your email looks legit — it actually checks if the damn thing can receive mail.

This isn’t some cute regex-only toy. This shit goes all the way: DNS, MX, SMTP handshake — the whole fucking pipeline.


What This Bad Boy Does

  • Syntax Validation – RFC-style format checks. No stupid a@b garbage.
  • 🚫 Disposable Email Detection – Blocks fake/temp inbox bullshit using fakefilter.
  • 🌐 DNS MX Verification – Checks if the domain even has mail servers configured.
  • 📬 SMTP Deliverability Test – Talks directly to the mail server like, “yo, does this user exist?”
  • Smart Provider Handling – Skips SMTP for big boys like Yahoo, Outlook, Hotmail, AOL, and iCloud because they block verification and don’t give a shit.
  • 🎛️ Configurable as Hell – Turn checks on/off depending on how paranoid you are.
  • 🔒 TypeScript Native – Proper types. No any nonsense. Powered by TypeScript.

Installation

Install it like a civilized engineer:

npm install @ejekanshjain/simple-email-validator

Or if you’re fancy:

pnpm install @ejekanshjain/simple-email-validator

Or living that fast life:

bun install @ejekanshjain/simple-email-validator

Quick Start (Let’s Validate Some Shit)

import { validateEmail } from '@ejekanshjain/simple-email-validator'

const result = await validateEmail({ email: '[email protected]' })

if (result.isValid === true) {
  console.log('✓ This email is legit as fuck')
} else if (result.isValid === false) {
  console.log(`✗ Nope. Broken shit: ${result.status}`)
} else {
  console.log(`⚠ Could not verify. Server being shady: ${result.status}`)
}

How The Hell It Works

This library doesn’t half-ass validation. It goes step by step:

1. Syntax Check

Regex-based validation:

  • No starting with a dot like [email protected]
  • No consecutive dots
  • Proper TLD (at least 2 characters)
  • Only valid characters allowed

If it fails here, it’s dead. End of story.


2. Disposable Email Check

Uses fakefilter to detect trash providers.

If someone signs up with [email protected], we shut that down instantly.


3. DNS MX Check

We query DNS for MX records.

No MX? That domain is basically a corpse.


4. Provider Detection

Big providers like Gmail and others don’t like being pinged.

So instead of giving you false negatives and random bullshit failures, we skip SMTP verification for them.

Smart. Not reckless.


5. SMTP Handshake (The Real Test)

This is where shit gets real.

  • Connect to port 25
  • HELO
  • MAIL FROM
  • RCPT TO
  • Interpret server response

If the server says:

  • “User unknown” → it’s dead.
  • Temporary error → we return null.
  • Accepts recipient → deliverable (unless catch-all).

This is as close as you get without actually sending an email.


API

validateEmail(options)

{
  email: string
  timeoutMs?: number
  regexCheck?: boolean
  fakeEmailCheck?: boolean
}

Returns:

Promise<ValidationResult>

ValidationResult

interface ValidationResult {
  isValid: boolean | null
  status: string
  reason?: string
  mxRecord?: string
}

Meaning of isValid

  • true → This email is good to go.
  • false → Absolutely broken.
  • null → Couldn’t verify. Server said “nah” or timed out.

Possible Status Values (Know Your Shit)

| Status | isValid | What It Means | | ------------------------------------ | ------- | ------------------------- | | Deliverable | true | Email is solid | | Invalid Syntax | false | Format is garbage | | Disposable Email Detected | false | Fake/temp inbox | | No MX Records (Domain Dead) | false | Domain has no mail server | | User Unknown | false | Address doesn’t exist | | Skipped SMTP (Provider blocks pings) | null | Big provider blocking | | Timeout | null | Server too slow | | Connection Error | null | Couldn’t connect | | Server Reject (Greylist/Spam) | null | Server didn’t like us |


Real Talk: Important Considerations

False Negatives

Big providers block SMTP verification. Greylisting exists. Anti-spam filters exist.

Sometimes you’ll get null. That’s life.


False Positives

Catch-all servers exist. Some mail servers accept everything and bounce later.

So yeah, no validator on Earth is 100% perfect.


Rate Limiting

You’re opening real SMTP connections.

Spam this aggressively and you might:

  • Hit rate limits
  • Get blocked
  • Get your IP blacklisted

So chill the fuck out and cache results.


Performance

Full validation can take 1–5 seconds.

DNS + SMTP isn’t instant magic.

If you need speed:

  • Skip SMTP
  • Run async
  • Batch process

Error Handling

This library does not throw random-ass exceptions.

Everything is returned cleanly inside ValidationResult.

Example:

await validateEmail({ email: 'not-an-email' })
// { isValid: false, status: 'Invalid Syntax' }

No crashes. No drama. Just structured results.


License

MIT © Ekansh Jain

Do whatever you want with it. Just don’t blame the library when some weird mail server behaves like a diva.


Contributing

PRs welcome.

But please:

  • Don’t submit half-baked garbage.
  • Write tests.
  • Don’t break existing behavior.

Repository

https://github.com/ejekanshjain/simple-email-validator


If you’re tired of fake signups, trash leads, and garbage email validation logic…

Use this.

Validate like a savage.