0.1.1 • Published 4 months ago

dns-email-validation v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

dns-email-validation

About

Test CI

dns-email-validation is a typescript library that performs deep validation for the existence of an email address with validation of DNS records.

The main idea is to receive DNS record data instantly, even if the domain or email was created recently. Improved validation interface.

Installation:

npm install dns-email-validation
#OR
yarn add dns-email-validation
#OR
pnpm add dns-email-validation

Interface

By default:

{
  MX: true;
}

You can specify additional settings:

export interface IDnsEmailValidationOptions {
  MX?: boolean; // validation of MX records
  NS?: boolean; // validation of NS records
  A?: boolean; // validation of A records
}

Error codes

  • MX - MX record is missing
  • NS - NS record is missing
  • A - A record is missing
  • BAD_EMAIL - email address was incorrectly
  • ENOTFOUND - domain does not exist
  • UNKNOWN - unknown error

Example:

console.log(await DnsEmailValidation.verify('mail@gmail.com')); // { verification: true }
console.log(await DnsEmailValidation.verify('mail@example.com')); // { verification: false, reason: [ 'MX' ] }

Example: dns-email-validation-example

License

Licensed under MIT (LICENSE / http://opensource.org/licenses/MIT)

0.1.1

4 months ago

0.1.0

4 months ago

0.0.5

4 months ago

0.0.4

4 months ago

0.0.3

4 months ago

0.0.2

4 months ago

0.0.1

4 months ago