查找负责邮件域的提供商
供应商,我的意思是负责邮件的供应商,例如gmail 供应商将是gmail(或/由谷歌),而microsoft.com它将会是outlook(由微软)。
基本上,我想找出给定的电子邮件域,例如abc@xyz.com,hxy@tuv.com在我们的案例中来自特定的提供商(outlook 或 gmail),因为它属于哪个提供商,xyz或者tuv不明确。
我取得了一些成功,我的想法是利用MX记录,所以我在 nodejs 中做了这样的事情:
const dnsMod = require('dns');
dnsMod.resolveMx(
'mydomain.com', (err, value)=>{
console.log('The error is : ', err);
console.log('The value is : ', value);
}
)
它返回这样的记录:
[
{ exchange: 'alt3.gmail-smtp-in.l.google.com', priority: 30 },
{ exchange: 'alt1.gmail-smtp-in.l.google.com', priority: 10 },
{ exchange: 'gmail-smtp-in.l.google.com', priority: 5 },
{ exchange: 'alt2.gmail-smtp-in.l.google.com', priority: 20 },
{ exchange: 'alt4.gmail-smtp-in.l.google.com', priority: 40 }
]
因此,看到这一点,我们可以得出结论,在这种情况下提供者是 infact gmail。
But, my point is, is it safe to conclude the provider is gmail just it contains words like google, gmail etc. In other words, do google's mail servers always have a google.com in the end, (or Similarly, microsoft's mail provider have outlook.com or microsoft.com in the end)? If not, what better way would be to confirm this?
EDIT: As per suggested by comment, I need the information because, based on the information I need to show only one of google or outlook button.