Skip to content

Instantly share code, notes, and snippets.

@mittsh
Last active May 13, 2018 17:48
Show Gist options
  • Save mittsh/bda215aea852f5f95dffc776241135b6 to your computer and use it in GitHub Desktop.
Save mittsh/bda215aea852f5f95dffc776241135b6 to your computer and use it in GitHub Desktop.
const domainUsesGoogleMail = domain => {
return fetch('https://dns.google.com/resolve?name=' + encodeURIComponent(domain) +'&type=MX').then(res => res.json()).then(d => {
return d.Answer.reduce((acc, val) => {
return acc || (val.data.indexOf('google.com.') >= 0 || val.data.indexOf('googlemail.com.') >= 0)
}, false)
})
}
const showMailServer = domain => {
domainUsesGoogleMail(domain).then(r => {
console.log(r ? `${domain} uses Google Mail` : `${domain} does not use Google Mail`)
})
}
showMailServer('paw.cloud')
showMailServer('l214.com')
showMailServer('rain-blog.com')
showMailServer('microsoft.com')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment