Lightweight email validation package with advanced features including MX record validation and blacklisting, dependency free.
npm install email-assassin    
Lightweight email validation package for Node.js
* Syntax Validation - Validates email address format / syntax based on RFC standards.
* Email Blacklisting - Optionally validate against a list of over 550 disposable / problem email services.
* MX Record Validation - Validate whether the email address has valid MX DNS records attached at the domain level.
* Gmail Alias Detection - Optional detection of Gmail addresses using an alias address. More Information
```
$ npm install email-assassin`
To install devDependices for testing run from the project folder:`
npm install
npm test`
To run included examples:`
node ./example/checkEmail.js
node ./example/mxRecords.js
Optional Options Object
* blacklist - \
* gmailAlias - \
* rfcLength - \
`
// include email-assassin
var validate = require('email-assassin');
// test an email
var test = validate.syntax({
email: 'user+name@gmail.com',
options:{
blacklist: true,
gmailAlias: true
}
});
// output to console
console.log(test);
`
`
// include email-assassin
var validate = require('email-assassin');
// make async request
(async () => {
try {
const response = await validate.mxrecords('username@gmail.com');
console.log(response);
} catch (e) {
console.log(e);
}
})();
``
Why Should I Check For Them
In most cases denying usage for an alias address is not required. They are RFC valid syntax and allow Gmail users to tightly monitor where email is coming from and who might be spamming them. There are some use cases where you may want to disallow usage:
- Users creating multiple accounts for a website using the same address. By quickly adding an alias they can make another account as the email is different.
- Signing up for things like free trials and discounts, users can keep signing up for them easily by using alias addresses.
MIT © Tyler Colwell