Example #1
0
 public function __construct($options)
 {
     $params = $this->convertParams($options);
     $class = $params['protocol_class'];
     $this->protocol = new $class($params['host'], $params['port'], $params['ssl']);
     $this->protocol->login($params['user'], $params['password']);
     $class = $params['storage_class'];
     $this->storage = new $class($this->protocol);
 }
Example #2
0
 /**
  * set flags for message
  *
  * NOTE: this method can't set the recent flag.
  *
  * @param  int   $id    number of message
  * @param  array $flags new flags for message
  * @throws \Zend\Mail\Storage\Exception
  */
 public function setFlags($id, $flags)
 {
     if (!$this->_protocol->store($flags, $id)) {
         throw new Exception\RuntimeException('cannot set flags, have you tried to set the recent flag or special chars?');
     }
 }
Example #3
0
 public function testStore()
 {
     $protocol = new Protocol\Imap($this->_params['host']);
     $protocol->login($this->_params['user'], $this->_params['password']);
     $protocol->select('INBOX');
     $this->assertTrue($protocol->store(array('\\Flagged'), 1));
     $this->assertTrue($protocol->store(array('\\Flagged'), 1, null, '-'));
     $this->assertTrue($protocol->store(array('\\Flagged'), 1, null, '+'));
     $result = $protocol->store(array('\\Flagged'), 1, null, '', false);
     $this->assertTrue(in_array('\\Flagged', $result[1]));
     $result = $protocol->store(array('\\Flagged'), 1, null, '-', false);
     $this->assertFalse(in_array('\\Flagged', $result[1]));
     $result = $protocol->store(array('\\Flagged'), 1, null, '+', false);
     $this->assertTrue(in_array('\\Flagged', $result[1]));
 }