Jump to content
Gonzalez

[PHP] E-Mail Verifier

Recommended Posts

Posted
if (!function_exists("checkdnsrr"))
{
function checkdnsrr($host, $type="")
{
if (!empty($host))
{
if ($type == "")
$type = "MX";
@exec("nslookup -type=" . $type . " " . $host, $output);
while (list($k, $line) = each($output))
{
if (eregi("^" . $host, $line))
return true;
}
return false;
}
}
}

function check_email($e)
{
if ((preg_match("/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/", $e)) || (preg_match("/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/", $e)))
{
$h = explode('@', $e);
if (checkdnsrr($h[1] . '.', "MX"))
return true;
if (checkdnsrr($h[1] . '.', 'A'))
return true;
if (checkdnsrr($h[1] . '.', "CNAME"))
return true;
}
return false;
}

if (check_email("webmsater@nasa.gov"))
spam("webmaster@nasa.gov"); // spam() not included in this snippet.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...