如何验证未分配的电子邮件

时间:2017-01-11 09:28:21

标签: php email cmd nslookup

我想知道这个网站http://verify-email.org/如何检查email是否实际属于某些domain或某些smtp

我试过这个nslookup

<?php
// Function to check whether a given hostName is a valid email
// domain address.
function myCheckDNSRR($hostName, $recType = '')
{
    if(!empty($hostName)) {
        if( $recType == '' ) $recType = "MX";
        exec("nslookup -type=$recType $hostName", $result);
        // check each line to find the one that starts with the host
        // name. If it exists then the function succeeded.
        foreach ($result as $line) {
            if(eregi("^$hostName",$line)) {
                return true;
            }
        }
        // otherwise there was no mail handler for the domain
        return false;
    }
    return false;
}

// If you are running this test on a Windows machine, you'll need to
// uncomment the next line and comment out the checkdnsrr call:
//if (myCheckDNSRR("joemarini.com","MX"))
if (checkdnsrr("dilip","MX")) // previously they had joemarini.com","MX"
    echo "yup - valid email!";
else
    echo "nope - invalid email!";
?>

我从sitepoint获得了此代码,该代码未达到http://verify-email.org/的水平。

我的问题code是否需要进行任何修改以配合本网站的功能http://verify-email.org/

0 个答案:

没有答案