Skip to content

A simple package to validate format and MX for an e-mail address.

License

Notifications You must be signed in to change notification settings

bsonmez/email-validator-node

Repository files navigation

email-validator-node

A simple package to validate format and MX for an e-mail address.

Installation

Install via Yarn:

yarn add email-validator-node

Usage

Node

var {
  checkEmail,
  isEmailFormatValid,
  isMXRecordValid,
  isBlacklisted,
} = require("email-validator-node");

(async () => {
  // checkEmail includes all other validation methods inside. If you run it, no need to run others.
  await checkEmail("[email protected]"); // { isValid:true }
  await checkEmail("[email protected]"); // { isValid:false, message:"not-found" }
  await checkEmail("[email protected]"); // { isValid:false, message:"blacklist" }

  // checks only email format
  await isEmailFormatValid("[email protected]"); // true
  await isEmailFormatValid("[email protected]"); // false

  // checks only MX records for the email
  await isMXRecordValid("[email protected]"); // false
  await isMXRecordValid("[email protected]"); // { isValid:true ,mxRecords:[] }

  // checks if the domain disposable or not
  await isBlacklisted("[email protected]"); // true
  await isBlacklisted("[email protected]"); // false
})();

Contribute

Contributions welcome! Check the LICENSE file for more info.

License

Distributed under the unlicense public domain. See LICENSE for more information.

About

A simple package to validate format and MX for an e-mail address.

Resources

License

Stars

Watchers

Forks

Packages

No packages published