/** * create instance with parameters * Supported paramters are * - host hostname or ip address of POP3 server * - user username * - password password for user 'username' [optional, default = ''] * - port port for POP3 server [optional, default = 110] * - ssl 'SSL' or 'TLS' for secure sockets * * @param $params array mail reader specific parameters * @throws \Zend\Mail\Storage\Exception * @throws \Zend\Mail\Protocol\Exception */ public function __construct($params) { if (is_array($params)) { $params = (object)$params; } $this->_has['fetchPart'] = false; $this->_has['top'] = null; $this->_has['uniqueid'] = null; if ($params instanceof Protocol\Pop3) { $this->_protocol = $params; return; } if (!isset($params->user)) { throw new Exception\InvalidArgumentException('need at least user in params'); } $host = isset($params->host) ? $params->host : 'localhost'; $password = isset($params->password) ? $params->password : ''; $port = isset($params->port) ? $params->port : null; $ssl = isset($params->ssl) ? $params->ssl : false; $this->_protocol = new Protocol\Pop3(); $this->_protocol->connect($host, $port, $ssl); $this->_protocol->login($params->user, $password); }