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)
const EmailDomainValidator = require("email-domain-validator");
EmailDomainValidator.validate("test@test.com")
.then(function(data){
console.log("Success ", data);
})
.catch(function(err){
console.log("ERR: ", err);
});
import { validate } from"email-domain-validator";
validate("test@test.com")
.then(function(data){
console.log("Success ",data);
})
.catch(function(err){
console.log("ERR: ", err);
});
{
isValidDomain: true,
erorrMessage: [],
invalidEmailList: []
}
{
isValidDomain: false,
erorrMessage: [ 'test@test.com - queryMx ENODATA test.com'],
invalidEmailList: [ 'test@test.com']
};