예제 #1
0
 public function __construct(IMAPMailbox $mailbox, $sequence)
 {
     $result = imap_fetch_overview($mailbox->getStream(), $sequence);
     if (FALSE === $result) {
         throw new Exception('Overview failed: ' . imap_last_error());
     }
     $this->mailbox = $mailbox;
     foreach ($result as $overview) {
         if (!isset($overview->subject)) {
             $overview->subject = '';
         } else {
             $overview->subject = IMAP::decodeToUTF8($overview->subject);
         }
     }
     parent::__construct($result);
 }
예제 #2
0
 public function __construct(IMAPMailbox $mailbox, $number)
 {
     $this->mailbox = $mailbox;
     $this->number = $number;
     $this->stream = $mailbox->getStream();
 }
예제 #3
0
 /**
  * Get a collection of mailboxes
  *
  * There are two special characters you can pass as part of the pattern: '*' and '%'.
  * '*' means to return all mailboxes. If you pass pattern as '*', you will get a list of the 
  * entire mailbox hierarchy. '%' means to return the current level only. '%' as the pattern 
  * parameter will return only the top level mailboxes; '~/mail/%' on UW_IMAPD will return 
  * every mailbox in the ~/mail directory, but none in subfolders of that directory.
  *
  * @param  string
  * @return IMAPMailbox[]
  * @throws IMAPException
  * @throws IllegalStateException
  */
 public function getMailboxes($glob = '*')
 {
     $this->checkConnected();
     if (!$glob) {
         $glob = '*';
     }
     $list = imap_getmailboxes($this->mbox, '{' . c('imap.host', 'localhost') . '}', $glob);
     if (!is_array($list)) {
         throw new IMAPException('Failed to list mailboxes');
     }
     return IMAPMailbox::fromList($list, $this);
 }