email-domain-validator
v2.0.1
Published
To validate email host & mail exchange using DNS protocol
Downloads
1,377
Maintainers
Readme
email-domain-validator
NMP module to validate email host & mail exchange using DNS protocol.
Features
- Email host mail exchange (MX) validation using DNS protocol.
- Email address string validation using JOI
(Supports Typescript without any additional type definitions)
//Code snippet for Javascript
const EmailDomainValidator = require("email-domain-validator");
// To validate multiple email id give input as comma seperated string "[email protected], [email protected]"
EmailDomainValidator.validate("[email protected]")
.then(function(data){
console.log("Success ", data);
})
.catch(function(err){
console.log("ERR: ", err);
});
//Code snippet for Typescript
import { validate } from"email-domain-validator";
validate("[email protected]")
.then(function(data){
console.log("Success ",data);
})
.catch(function(err){
console.log("ERR: ", err);
});
//Valid Domain Response Object
{
isValidDomain: true,
erorrMessage: [],
invalidEmailList: []
}
//Valid Domain Response Object
{
isValidDomain: false,
erorrMessage: [ '[email protected] - queryMx ENODATA test.com'],
invalidEmailList: [ '[email protected]']
};