# simple-email-verifier

> Email verification by looking for SMTP records and account existence checking

Latest version **1.2.0** (published 2021-10-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install simple-email-verifier
pnpm add simple-email-verifier
yarn add simple-email-verifier
bun add simple-email-verifier
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2021-10-05 |
| First published | 2021-10-05 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | ciricc |
| Maintainers | ciricc |
| Keywords | email verifier, smtp email verifier, check email, email checker, email, mail |

## Links

- npm: https://www.npmjs.com/package/simple-email-verifier
- Repository: https://github.com/ciricc/simple-email-verifier
- Homepage: https://github.com/ciricc/simple-email-verifier#readme
- Issues: https://github.com/ciricc/simple-email-verifier/issues
- npm.io page: https://npm.io/package/simple-email-verifier

## Dependencies (1)

- [dnscache](https://npm.io/package/dnscache.md) ^1.0.2

## 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

- 1.2.0 (latest) — 2021-10-05
- 1.0.3 — 2021-10-05
- 1.0.2 — 2021-10-05
- 1.0.1 — 2021-10-05
- 1.0.0 — 2021-10-05

## README

# Simple Email Verification

This class can help you to check that some email is realy exists in the Internet.
For example, if you don't want to send email verification message with code, but just want to check that email wasn't generated by `RANDOM_EMAIL()` function.

## Method

1. First, it's a simple regular expression checking. Verify that email have a normal format.
2. Second, it's looking for [MX records](https://en.wikipedia.org/wiki/MX_record) by DNS resolving.
3. And the last step is checking for account exists in the SMTP server by sending some protocol messages.

## Installation

```shell
npm i simple-email-verifier
```

## Usage

```js
const { EmailVerifier } = require("simple-email-verifier");

let verifier = new EmailVerifier(10000);

verifier.verify("admin@vk.com").then(result => {
  if (result) {
    console.log("This email realy exists :)");
  } else {
    console.log("Email not found :(");
  }
}).catch(console.error);
```

## API

* `EmailVerifier(timeout: number, dnsCacheSettings: Object, mailFrom: string)` - Main verifier class, where `mailFrom` - is your random server email, `timeout` - is timeout for email verify in `.verifySmtpRecord()` method. And `dnsCacheSettings` are settings for [dnscache](https://github.com/yahoo/dnscache) package.
* `verifier.verify(email: string): Promise<boolean>` - Full email verify promise.
* `verifier.isValidEmail(email: string): boolean` - Validate email by regular expression.
* `verifier.getEmailDomain(email: string): string` - Get email domain after `@` symbol.
* `verifier.checkMx(email: string): Promise<[]MxRecord>` - Look for MX records by DNS resolve.
* `verifier.verifySmtpRecord(mxRecord: string, email: string): Promise<boolean>` - Check email account existing in the SMTP server.

### Typings

Some types of this module.

#### MxRecord
MX record object

* <b>exchange</b> - Mail Exhange
* <b>priority</b> - Exchange priority

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