# vasya-email-validator

> Validates emails based on regex, common typos, disposable email blacklists, DNS records and SMTP server response.

Latest version **0.0.2** (published 2022-03-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install vasya-email-validator
pnpm add vasya-email-validator
yarn add vasya-email-validator
bun add vasya-email-validator
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2022-03-16 |
| First published | 2022-03-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 31.1 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Yilong Piao |
| Maintainers | seniorfulldev |
| Keywords | email-validation, email-typos, email-regex, disposable-emails, smtp, mx-records |

## Links

- npm: https://www.npmjs.com/package/vasya-email-validator
- Repository: https://github.com/seniorfulldev/vasya-email-validator
- Homepage: https://github.com/seniorfulldev/vasya-email-validator#readme
- Issues: https://github.com/seniorfulldev/vasya-email-validator/issues
- npm.io page: https://npm.io/package/vasya-email-validator

## Dependencies (4)

- [axios](https://npm.io/package/axios.md) ^0.24.0
- [mailcheck](https://npm.io/package/mailcheck.md) ^1.1.1
- [disposable-email-domains](https://npm.io/package/disposable-email-domains.md) ^1.0.59
- [@types/disposable-email-domains](https://npm.io/package/@types/disposable-email-domains.md) ^1.0.1

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2022-03-16
- 0.0.1 — 2022-03-16

## README

# Email Validator

[![NPM](https://nodei.co/npm/vasya-email-validator.png)](https://nodei.co/npm/vasya-email-validator/)

Validates email addresses based on regex, common typos, disposable email blacklists, DNS records and SMTP server response.

- Validates email looks like an email i.e. contains an "@" and a "." to the right of it.
- Validates common typos e.g. example@gmaill.com using [mailcheck](https://github.com/mailcheck/mailcheck).
- Validates email was not generated by disposable email service using [disposable-email-domains](https://github.com/ivolo/disposable-email-domains).
- Validates MX records are present on DNS.
- Validates SMTP server is running.
- Validates mailbox exists on SMTP server.
- Native typescript support.



## Getting Started

Comaptible with nodejs only. Not browser ready.

Install like so

```
npm i vasya-email-validator --save
```

or with yarn

```
yarn add vasya-email-validator
```

Use like so

```typescript
import validate from 'vasya-email-validator'

// or 
// const  {validate}  = require("vasya-email-validator");

const main = async () => {
  let res = await validate('vasya99110@gmail.com')
  // {
  //   "valid": false,
  //   "reason": "smtp",
  //   "validators": {
  //       "regex": {
  //         "valid": true
  //       },
  //       "typo": {
  //         "valid": true
  //       },
  //       "disposable": {
  //         "valid": true
  //       },
  //       "mx": {
  //         "valid": true
  //       },
  //       "smtp": {
  //         "valid": false,
  //         "reason": "Mailbox not found.",
  //       }
  //   }
  // }

  // Can also be called with these default options
  await validate({
    email: 'name@example.org',
    sender: 'name@example.org',
    validateRegex: true,
    validateMx: true,
    validateTypo: true,
    validateDisposable: true,
    validateSMTP: true,
  })
}
```

[Default options can be found here](https://github.com/seniorfulldev/vasya-email-validator/blob/cefb37abc6e42d3a1551d38f9706d4ff538226e5/src/options/options.ts#L1)

---
_Source: https://npm.io/package/vasya-email-validator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
