I'm doing an API that receives a JSON with various information of people, inside those an email, I need to validate if the email has the correct format, if the domain is correct and if the correct one actually exists in that domain.
This is the code that I currently have and it tells me if the domain exists and if it is well written but I need to know if that email exists too!
HELP !!
const dns = require('dns');
function Validar_email(email){
let domain = email.split('@')[1];
dns.resolve(domain, 'MX', function(err, addresses) {
if (err) {
console.log("Error")
console.log(err)
} else if (addresses && addresses.length > 0) {
console.log("Correcto")
}
})
}