您现在的位置: 军旅同心 >> 读书赏析 >> 学习园地 >> 电脑网络 >> 技术文章 >> 文章正文
pop3邮件收取一例
作者:采集员 文章来源:来源于网络 点击数: 更新时间:2005-9-10 14:34:49
sp;           case -3:
                                return("-3 socket could not be created");
                        case -4:
                                return("-4 dns lookup on hostname "$hostname" failed");
                        case -5:
                                return("-5 connection refused or timed out");
                        case -6:
                                return("-6 fdopen() call failed");
                        case -7:
                                return("-7 setvbuf() call failed");
                        default:
                                return("");
                }
        }

        Function CloseConnection()
        {
                if($this->connection!=0)
                {
                        fclose($this->connection);
                        $this->connection=0;
                }
        }

        Function Open()
        {
                if($this->state!="DISCONNECTED")
                        return("1 a connection is already opened");
                if(($error=$this->OpenConnection())!="")
                        return($error);
                $this->greeting=$this->GetLine();
                if(GetType($this->greeting)!="string"
                || strtok($this->greeting," ")!="+OK")
                {
                        $this->CloseConnection();
                        return("3 POP3 server greeting was not found");
                }
                $this->greeting=strtok(" ");
                $this->must_update=0;
                $this->state="AUTHORIZATION";
                return("");
        }
        
        Function Close()
        {
                if($this->state=="DISCONNECTED")
                        return("no connection was opened");
                if($this->must_update)
                {
                        if($this->PutLine("QUIT")==0)
                                return("Could not send the QUIT command");
                        $response=$this->GetLine();
                        if(GetType($response)!="string")
                                return("Could not get quit command response");
                        if(strtok($response," ")!="+OK")
                                return("Could not quit the connection: ".strtok(" "));
                }
                $this->CloseConnection();
                $this->state="DISCONNECTED";
                return("");
        }

        Function Login($user,$password,$apop)
        {
                if($this->state!="AUTHORIZATION")
                        return("connection is not in AUTHORIZATION state");
                if($apop)
                {
                        if($this->PutLine("APOP $user ".md5($this->greeting.$password))==0)
                                return("Could not send the APOP command");
                        $response=$this->GetLine();
           &nbs

上一页  [1] [2] [3] [4] [5] 下一页


 
免责声明:作品版权归所属媒体与作者所有!!本站刊载此文不代表同意其说法或描述,仅为提供更多信息。如果您认为我们侵犯了您的版权,请告知!本站立即删除。有异议请联系我们。
文章录入:烟灰缸    责任编辑:烟灰缸 
网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
| 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 网站公告 | 管理登录 |