将IMAP电子邮件标记为读取不起作用

时间:2014-05-30 07:50:42

标签: php imap

好的,所以我的问题显然在标题内。 这段代码我做错了什么?

输入:

function mark_email_as_read() {

    if (isset($_SESSION['talent_user_id']) and $_SESSION['talent_user_id'] > 0) {

    $peek = $this->peek();  
    $uid = $this->common_model->search_get($this->url, 'uid');
    $msgno = imap_msgno($this->imap, $uid);
    $user_id = $_SESSION[$this->session_prefix.'_user_id'];
    $acc = $this->common_model->search_get($this->url,'acc');
    $folder = $this->common_model->search_get($this->url,'accfolder');

    $ssl = false;

    $ssl=($ssl==false)?"/novalidate-cert":"";

    $host = $this->email_accounts[$this->the_helpdesk_view][$this->the_helpdesk_company]['server'];
    $port = $this->email_accounts[$this->the_helpdesk_view][$this->the_helpdesk_company]['port'];
    $folder = $this->email_accounts[$this->the_helpdesk_view][$this->the_helpdesk_company]['folder'];
    $user = $this->email_accounts[$this->the_helpdesk_view][$this->the_helpdesk_company]['user'];
    $pass = $this->email_accounts[$this->the_helpdesk_view][$this->the_helpdesk_company]['pass'];

        $this->imap = imap_open("{"."$host:$port/imap$ssl"."}$folder", $user, $pass) or die("can't connect: " . imap_last_error());

        $imap = $this->imap;

        $msgnum = imap_msgno($imap, $msgno);

        if ($peek==true) {
            imap_clearflag_full($imap, $msgnum, '\flagged');
            echo"oh dear";
        } else {
            imap_setflag_full($imap, $msgnum, '\seen');
            echo"set";
        }
        echo "its working i think";
        imap_headers($this->imap);
        echo"well its got here";
    }
}

输出:

它没有显示任何东西,但它不会标记为Seen。你能帮忙吗?

0 个答案:

没有答案