comprehensive-email-checker
v0.1.0
Published
> A comprehensive checker for email addresses
Downloads
3
Readme
comprehensive-email-checker
A comprehensive checker for email addresses
Currently checks:
- Syntax - validate the address according to RFCs 5321, 5322, and others using hapijs/isemail.
- Disposable addresses - test if the address is a disposable (temporary/throwaway) address, e.g. [email protected], using FGRibreau/mailchecker.
- Suggestions - check for possible misspelling using mailcheck/mailcheck.
WIP:
- Specific grammars of some email providers - some ESPs have their own set of rules, e.g. [email protected] cannot be a valid email address. Test using tepez/comprehensive-email-checker.
- DNS
Usage
const EmailChecker = require('comprehensive-email-checker');
EmailChecker.validate('[email protected]').then((result) => {
/**
{
isValid: true,
isDisposableAddress: false,
suggestion: null
}
**/
});
API
validate(address, options)
Return a promise that resolves with a results object containing. If the syntax of the email was not valid, then none of the other tests will run and the results object will be:
{
isValid: false,
suggestion: null,
isDisposableAddress: null
}
```json
If the syntax is valid, then the results object will be:
{ isValid: true suggestion: An email address (string) if there is a suggestion or null if there is not isDisposableAddress: true/false this is a disposable address }
#### address
Type: `string`
#### options
Type: object
##### checkSyntaxOptions
Type: object
Options to pass to [isemail](https://github.com/hapijs/isemail#validateemail-options-callback)
Default: null
#### checkSuggestionsOptions
Type: object
Default: null
Options to pass to [mailcheck](https://github.com/mailcheck/mailcheck#usage-without-jquery)
Do not pass the `suggested` or `empty` callback options as they are used internally.