for internal use only - Draft idea to check trustworthiness of email account
Check if email is from disposable provider or has no DNS MX record
yarn add @jollie/unsafe-emailor
npm install @jollie/unsafe-emailconst isUnsafeEmail = require('@jollie/unsafe-email');
// Diposable email
// Output "Unsafe email : Disposable email address"
isUnsafeEmail('contact@yopmail.com')
.then(() => console.log('Looks good'))
.catch(error => console.log(`Unsafe email : ${error.message}`);
// Non-existent domain
// Output "Unsafe email : queryMx ENOTFOUND he-llo-w-orld.com"
isUnsafeEmail('contact@he-llo-w-orld.com')
.then(() => console.log('Looks good'))
.catch(error => console.log(`Unsafe email : ${error.message}`);
// Valid email -> Output "Looks good"
isUnsafeEmail('contact@google.com')
.then(() => console.log('Looks good'))
.catch(error => console.log(`Unsafe email : ${error.message}`);Promise resolved with the email or rejected if unsafe email