Exemplo n.º 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);
 }
Exemplo n.º 2
0
 /**
  * Special handling for hasTop and hasUniqueid. The headers of the first message is
  * retrieved if Top wasn't needed/tried yet.
  *
  * @see AbstractStorage::__get()
  * @param  string $var
  * @return string
  */
 public function __get($var)
 {
     $result = parent::__get($var);
     if ($result !== null) {
         return $result;
     }
     if (strtolower($var) == 'hastop') {
         if ($this->protocol->hasTop === null) {
             // need to make a real call, because not all server are honest in their capas
             try {
                 $this->protocol->top(1, 0, false);
             } catch (MailException\ExceptionInterface $e) {
                 // ignoring error
             }
         }
         $this->has['top'] = $this->protocol->hasTop;
         return $this->protocol->hasTop;
     }
     if (strtolower($var) == 'hasuniqueid') {
         $id = null;
         try {
             $id = $this->protocol->uniqueid(1);
         } catch (MailException\ExceptionInterface $e) {
             // ignoring error
         }
         $this->has['uniqueid'] = $id ? true : false;
         return $this->has['uniqueid'];
     }
     return $result;
 }
Exemplo n.º 3
0
 public function testReadAfterClose()
 {
     $protocol = new Protocol\Pop3($this->_params['host']);
     $protocol->logout();
     try {
         $protocol->readResponse();
     } catch (\Exception $e) {
         return;
         // test ok
     }
     $this->fail('no exception while reading from closed socket');
 }
Exemplo n.º 4
0
 public function testReadAfterClose()
 {
     $protocol = new Protocol\Pop3($this->_params['host']);
     $protocol->logout();
     $this->setExpectedException('Zend\\Mail\\Storage\\Exception\\InvalidArgumentException');
     $protocol->readResponse();
 }