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

WBOY
發布: 2016-07-13 17:35:56
原創
1101 人瀏覽過


$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...
相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新問題
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!