Here’s a handy bit of PHP code that will take the email variable, lookup the mail server for the domain, log into the mail server and see if it will accept delivery for that address.[code=php](.*)/’, $_REQUEST[’email’], -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
$email = array_pop ($split);
$split = explode (“@”, $email);
$domain = $split[1];
getmxrr ($domain, $a, $b);
if ($a) {
foreach ($a as $key => $val) {
$c[$b[$key]] = $val;
}
ksort ($c);
} else {
$c[0] = $domain;
}
$fp = fsockopen (array_shift($c), 25, $errno, $errstr, 30);
$return = fgets ($fp, 1024);
fputs ($fp, “helo none.com\r\n”);
$return = fgets ($fp, 1024);
fputs ($fp, “mail from:
$return = fgets ($fp, 1024);
fputs ($fp, “rcpt to:<" . $email . ">\r\n”);
$return = fgets ($fp, 1024);
fputs ($fp, “quit”);
fclose($fp);
if (substr($return, 0, 3) > 250) {
echo “Bad email”;
} else {
echo “Good email”;
}
?>[/code]Okay, okay… the truth is I just got done adapting the GeSHi syntax highlighter into a WordPress plug-in and wanted to make sure it worked, so I needed to post some code of some sort. 🙂
Page looks a little funny in IE. Side menu seems to be messing it up.
i made a test site and the script say yes to every email i put or it does not work if i put the wrong domain.
http://www.yourfreefax.com/testcheckemail.html
what did i do wrong?