You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

dns-email-validation

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dns-email-validation

Deep validation for the existence of an email address with validation of DNS records.

0.1.1
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

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)

Keywords

email

FAQs

Package last updated on 20 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts