Skip to content

Instantly share code, notes, and snippets.

@marcieltorres
Created August 25, 2018 01:58
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcieltorres/eac29c8fa334a152b07db9a7fec4162e to your computer and use it in GitHub Desktop.
Save marcieltorres/eac29c8fa334a152b07db9a7fec4162e to your computer and use it in GitHub Desktop.
nodeJS-get-mx-records-from-domain
var dns = require('dns');
function getMxRecords(domain){
return new Promise(function(resolve, reject) {
dns.resolveMx(domain, function (err, addresses) {
if (err) {
//console.log(err, err.stack)
resolve(null);
}
else{
//console.log(addresses);
resolve(addresses);
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment