Detect Provider's Service name by email address
team@youtube.com -> { name: 'Gmail', url: 'https://googlemail.com' }
test@kinopoisk.ru -> { name: 'Яндекс', url: 'https://yandex.ru' }
It can be useful for improving User Experience after entering an email address:
- User enters an email address
- You have sent confirmation email to him
- On the same place, you can show
Open Gmail|Yahoo|Яндекс|etc
button
- Fetching DNS MX records for email address
- Find MX host at the free email services datastore, collected by freemail
- Find Service product name by its hostname (
googlemail.com
->Gmail
)
npm i --save email-provider
or
yarn add email-provider
const emailProvider = require('email-provider');
let email = '[email protected]';
emailProvider.get(email)
.then( service => {
console.log(service.name); // Gmail
console.log(service.url); // https://googlemail.com
})
.catch( error => {
console.log('Email provider was not reached:', error);
})
MIT