Heim  >  Artikel  >  Backend-Entwicklung  >  用php得到163的邮件信息_PHP教程

用php得到163的邮件信息_PHP教程

WBOY
WBOYOriginal
2016-07-13 17:35:561100Durchsuche


$host=pop.163.com;
$port=110;
$user=******;
$password=******;

if(!($sock=fsockopen(gethostbyname($host),$port,$errno,$errstr)))
        exit($errno.: .$errstr);
set_socket_blocking($sock,true);

$msg=fgets($sock);
echo $msg;

$command="user ".$user." ";
fwrite($sock,$command);
$msg=fgets($sock);
echo $msg;

$command="pass ".$password." ";
fwrite($sock,$command);
$msg=fgets($sock);
echo $msg;

$command="stat ";
fwrite($sock,$command);
$msg=fgets($sock);
echo $msg;

$command="list ";
fwrite($sock,$command);
while(true)
{
        $msg=fgets($sock);       
        echo $msg;
        if(preg_match(/^./,$msg))
                break;
}

$command="retr 1 ";
fwrite($sock,$command);
while(true)
{
        $msg=fgets($sock);
        echo $msg;
        if(preg_match(/^.( )$/,$msg))
                break;
}

$command="quit ";
fwrite($sock,$command);
$msg=fgets($sock);
echo $msg;
?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/508285.htmlTechArticle? $host=pop.163.com; $port=110; $user=******; $password=******; if(!($sock=fsockopen(gethostbyname($host),$port,$errno,$errstr))) exit($errno.: .$errstr); set_socket_blocking($sock...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn