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); }
/** * 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; }
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'); }
public function testReadAfterClose() { $protocol = new Protocol\Pop3($this->_params['host']); $protocol->logout(); $this->setExpectedException('Zend\\Mail\\Storage\\Exception\\InvalidArgumentException'); $protocol->readResponse(); }