' . "\r\n"); if (_expect_smtp_ok_reply($fd, 2) === FALSE) { fclose($fd); return NULL; } fwrite($fd, 'RCPT TO: <' . $email . '>' . "\r\n"); if (_expect_smtp_ok_reply($fd, 2) === FALSE) { fclose($fd); return FALSE; } fwrite($fd, 'DATA' . "\r\n"); if (_expect_smtp_ok_reply($fd, 3) === FALSE) { fclose($fd); return FALSE; } fclose($fd); return TRUE; } function is_valid_email($email) { @list($user, $host) = explode('@', $email); if (empty($user) || empty($host)) { return FALSE; } if (strstr($host, '.') === FALSE) { return FALSE; } $mxs = array(); $weights = array(); getmxrr($host, $mxs, $weights); if (empty($mxs)) { $mxs = gethostbynamel($host); $weights = array_fill(0, count($mxs), 0); } if (empty($mxs)) { return FALSE; } array_splice($mxs, TRY_EMAIL_MAX_MXS); array_splice($weights, TRY_EMAIL_MAX_MXS); array_multisort($weights, $mxs); foreach ($mxs as $mx) { if (($ret = @_try_email_delivery($email, $mx)) !== NULL) { return $ret; } } return NULL; } $ret = is_valid_email('caro@caramail.com'); var_dump($ret); ?>