如何让 checkdnsrr 使用 Spamhaus.org 而不是 MX?
我已获得此代码用于测试并验证传入的电子邮件地址是否有效。我知道这行得通,但圣诞节期间所有礼物的价格标签都被取消了。
就我而言,说明已被删除。根据我在这个脚本中看到的内容,“MX”告诉脚本使用 MX 验证数据库...我是否只需替换或添加它旁边的“spamhaus.org”即可使其工作?或者还不止于此?
我的服务器不是在 Windows 机器上,所以我不需要担心 checkdnsrr 不起作用。
另外,这个脚本有更好的版本吗?我很好奇,因为不幸的是 PHP 编码的这一部分对我来说是新的。
提前致谢。
// take a given email address and split it into the username and domain.
list($userName, $mailDomain) = split("@", $email);
if (checkdnsrr($mailDomain, "MX")) {
// this is a valid email domain!
}
else {
// this email domain doesn't exist! bad dog! no biscuit!
}
I've been given this code to utilize to test out, and verify if email addresses coming in are valid. I know this works, but again with all gifts during Christmas the price tag has been removed.
In my case, the instructions have been stripped. I am taking by what I see in this script that the "MX" is telling the script to use the MX Verify database... do I just replace or add next to it ,"spamhaus.org" to make it work? Or is it more than that?
I am not on a windows machine as my server so I don't need to worry checkdnsrr not working.
Also, is there a better version of this script out there? I'm curious because unthankfully this part of PHP coding is new to me.
Thanks in advance.
// take a given email address and split it into the username and domain.
list($userName, $mailDomain) = split("@", $email);
if (checkdnsrr($mailDomain, "MX")) {
// this is a valid email domain!
}
else {
// this email domain doesn't exist! bad dog! no biscuit!
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 http://php.net/manual/en/function.checkdnsrr.php 唯一支持的方法checkdnsr 的值为 A、MX、NS、SOA、PTR、CNAME、AAAA、A6、SRV、NAPTR、TXT 或 ANY。您无法添加自定义 URL。
尝试:
From http://php.net/manual/en/function.checkdnsrr.php the only supported methods for checkdnsr are A, MX, NS, SOA, PTR, CNAME, AAAA, A6, SRV, NAPTR, TXT or ANY. you can't add in a custom URL.
Try: