1.1.1 • Published 5 years ago
node-email-validator v1.1.1
node-email-validator
This npm package checks that whether an email address is a valid email address or not by checking the MX records. It also has a statistics based check that whether an email address has a possibility of being a temporary email, email belonging to a private organization or that mail server is not used much in that region. It also checks if the email address structure follows RFC 5322 Official Standard or not.
How to install?
- Just run the following statement.
npm install node-email-validatoror
npm i node-email-validatorHow to use it?
- Given below is an example on how to use this package.
var nev = require('node-email-validator');
nev('username@mail-server.extension').then(validation => {console.log(validation);}).catch(error => console.log(error));- The output for this is as follows.
{
user: 'xukrlrll',
domain: 'sharklasers.com',
isEmailValid: true,
mxRecords: [ { exchange: 'mail.guerrillamail.com', priority: 0 } ],
possibility: true,
timeout: false
}What is present in the response?
user- This contains the username part of the email address.domain- This contains the domain part of the email address.isEmailValid- This returnstrueorfalsedepending on the validity of the email address.mxRecords- It contains the MX records which are dictionaries ofexchangeandpriorityor[]if nothing is present.probability- This returnstrueorfalsedepending on the possibility of an email address being atemporary email,email belonging to a private organizationor thatmail server is not used much in that region.timeout- This returnstrueorfalsedepending on the fact that the query caused timeout or not.
How to run tests?
- For running the tests, run the following command.
npm test