예제 #1
0
 /**
  * Gets list of mailboxes from IMAP server
  *
  * @return array
  * @access public
  */
 function mailboxes($folder = null, $type)
 {
     global $atmail;
     $this->cid++;
     if ($this->protocol == 'POP3') {
         $this->errors[] = GM_NO_POP3_SUPPORT;
         return false;
     }
     if ($folder && $folder != $this->cur_folder) {
         $this->select($folder);
     }
     if ($this->use_native) {
         if ($type == LIST_SUBSCRIBED_ONLY) {
             $mboxes = imap_lsub($this->mailer, "\\{{$this->host}}", "*");
         } else {
             $mboxes = imap_list($this->mailer, "\\{{$this->host}}", "*");
         }
         if (is_array($mboxes)) {
             foreach ($mboxes as $k => $v) {
                 if (preg_match('/\\{.*?\\}INBOX\\.(.+)/', $v, $m)) {
                     $mboxes[$k] = imap_utf7_encode($m[1]);
                 } else {
                     $mboxes[$k] = 'Inbox';
                 }
             }
         }
         return $mboxes;
     } else {
         if ($atmail->isset_chk($type)) {
             $mboxes = $this->mailer->listMailboxes($folder, '*', false);
         } else {
             $mboxes = $this->mailer->listMailboxes($folder, '*', true);
         }
         return $mboxes;
     }
 }
예제 #2
0
<?php

echo "Checking with no parameters\n";
imap_lsub();
echo "Checking with incorrect parameter type\n";
imap_lsub('');
imap_lsub(false);
require_once dirname(__FILE__) . '/imap_include.inc';
$stream_id = imap_open($default_mailbox, $username, $password) or die("Cannot connect to mailbox {$default_mailbox}: " . imap_last_error());
imap_lsub($stream_id);
imap_lsub($stream_id, $default_mailbox);
var_dump(imap_lsub($stream_id, $default_mailbox, 'ezDvfXvbvcxSerz'));
echo "Checking OK\n";
$newbox = $default_mailbox . "." . $mailbox_prefix;
imap_createmailbox($stream_id, $newbox);
imap_subscribe($stream_id, $newbox);
$z = imap_lsub($stream_id, $default_mailbox, '*');
var_dump(is_array($z));
var_dump($z[0]);
imap_close($stream_id);
require_once 'clean.inc';
예제 #3
0
?>
    <ul id="folders" title="<?php 
echo l('Ordner');
?>
">
<?php 
include 'config.php';
$accnr = $_GET['acc'];
if (!isset($_GET['acc']) || !is_numeric($accnr)) {
    die("violation");
}
$serverarg = get_server_part($accnr);
$serveruser = get_server_user($accnr);
$serverpw = get_server_pw($accnr);
$mbox = imap_open($serverarg, $serveruser, $serverpw) or die("can't connect: " . imap_last_error());
$list = imap_lsub($mbox, $serverarg, "*");
if (is_array($list)) {
    sort($list);
    $folder_output = array('read' => '', 'unread' => '');
    foreach ($list as $val) {
        $folder_type = "read";
        $utdec = imap_utf7_decode($val);
        $utdec = preg_replace("/{(.*)}/", "", $utdec);
        $utdec = preg_replace("/\\//", "", $utdec, 1);
        $utdec = preg_replace("/INBOX/", "", $utdec, 1);
        $utdec = preg_replace("/\\./", "", $utdec, 1);
        imap_reopen($mbox, $val);
        $check = imap_status($mbox, $val, SA_UNSEEN | SA_MESSAGES);
        $colorstr = "";
        $dotcode = "";
        if ($check->unseen > 0) {