예제 #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);
 }
예제 #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;
 }
예제 #3
0
파일: Pop3Test.php 프로젝트: hjr3/zf2
 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');
 }
예제 #4
0
파일: Pop3Test.php 프로젝트: haoyanfei/zf2
 public function testReadAfterClose()
 {
     $protocol = new Protocol\Pop3($this->_params['host']);
     $protocol->logout();
     $this->setExpectedException('Zend\\Mail\\Storage\\Exception\\InvalidArgumentException');
     $protocol->readResponse();
 }