Esempio n. 1
0
 /**
  * get unique id for one or all messages
  *
  * if storage does not support unique ids it's the same as the message number
  *
  * @param int|null $id message number
  * @return array|string message number for given message or all messages as array
  * @throws Zend_Mail_Storage_Exception
  */
 public function getUniqueId($id = null)
 {
     if ($id) {
         return $this->_protocol->fetch('UID', $id);
     }
     return $this->_protocol->fetch('UID', 1, INF);
 }
Esempio n. 2
0
 public function getRawContent($id, $part = null)
 {
     if ($part !== null) {
         // TODO: implement
         throw new Zend_Mail_Storage_Exception('not implemented');
     }
     return $this->_protocol->fetch('RFC822.TEXT', $id);
 }
Esempio n. 3
0
 public function testFetch()
 {
     $protocol = new Zend_Mail_Protocol_Imap($this->_params['host']);
     $protocol->login($this->_params['user'], $this->_params['password']);
     $protocol->select('INBOX');
     $range = array_combine(range(1, 6), range(1, 6));
     $this->assertEquals($protocol->fetch('UID', 1, INF), $range);
     $this->assertEquals($protocol->fetch('UID', 1, 6), $range);
     $this->assertEquals($protocol->fetch('UID', range(1, 6)), $range);
     $this->assertTrue(is_numeric($protocol->fetch('UID', 1)));
     $result = $protocol->fetch(array('UID', 'FLAGS'), 1, INF);
     foreach ($result as $k => $v) {
         $this->assertEquals($k, $v['UID']);
         $this->assertTrue(is_array($v['FLAGS']));
     }
     try {
         $protocol->fetch('UID', 99);
     } catch (Exception $e) {
         return;
         // ok
     }
     $this->fail('no exception while fetching message');
 }