我正在尝试进行电子邮件验证,但似乎无法进行。目前它会建立与域的连接,但之后似乎超时。有人知道为什么吗?它似乎挂在这里:
$res=fgets($connection, "EHLO $mydomain\n");
Run Code Online (Sandbox Code Playgroud)
有人能告诉我这是为什么吗?我的代码如下:
if(isset($_POST['email']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL))
{
// Could get this from the php ini?
$from="xxxx@xxxx-int.net";
$to=$_POST['email'];
$subject="Test";
$message="Testing";
list($me,$mydomain) = split("@",$from);
// Now look up the mail exchangers for the recipient
list($user,$domain) = split("@",$to,2);
if(getmxrr($domain,$mx,$weight) == 0) return FALSE;
// Try them in order of lowest weight first
array_multisort($mx,$weight);
$success=0;
foreach($mx as $host) {
// Open an SMTP connection
$connection = fsockopen ($host, 25, $errno, $errstr, 1);
if (!$connection)
continue;
$res=fgets($connection);
echo $res;
if(substr($res,0,3) != "220") …Run Code Online (Sandbox Code Playgroud)