<?php$t= time (); $sk = Fsockopen (' tcp://smtp.qq.com ', $errno, $ERRSTR, 5); echo "Sockect OK:". (Time ()-$t). " \ n ";" if (! Is_resource ($sk)) exit (' Connect error: '. $errno. ") ". $errstr);//set to block mode stream_set_blocking ($sk, 1);//Get Initial link information var_dump (fgets ($SK, 512));//Set Read timeout stream_set_ Timeout ($sk, 3), Var_dump (Stream_get_meta_data ($sk)), fwrite ($sk, "EHLO qidizi.com\n");//This will cause a timeout, Personal judgment should be QQ in waiting for a line of input terminator, but \ n is not, should be \ r \ n is, will be stuck here does not output hint, this problem, in the previous version, and the current test, 163.com did not find this problem//fwrite ($sk, "EHLO Qidizi.com\r\n ");//the correct line terminator \ r \ n, will immediately get a response Var_dump (fgets ($SK, 512). ': '. ( Time ()-$t));//The above will not timeout echo "4:". (Time ()-$t). " \n<br/> "; Var_dump (Stream_get_meta_data ($sk)); fclose ($SK);
Test code
May QQ server in recent changes in the change, remember the previous can use \ n to do as a line of Terminator, that is, a fwrite ($sk, "kkk\n") to get a response, Fgets can immediately succeed, test a bit 163,\n is no problem, recently found that QQ \ N has a problem, causing no response, fgets because the buffer does not have content that causes an exception until the read time-out. But QQ changed to \ r \ n Normal.
So smtp.qq.com, and smtp.exmail.qq.com have this problem.
I started to think that some people were talking about becoming SSL. It's not. Now the 25 port is still working.