/** * @return Horde_Imap_Client_Socket */ public function getImapConnection() { if (is_null($this->client)) { $host = $this->account->getInboundHost(); $user = $this->account->getInboundUser(); $password = $this->account->getInboundPassword(); $password = $this->crypto->decrypt($password); $port = $this->account->getInboundPort(); $ssl_mode = $this->convertSslMode($this->account->getInboundSslMode()); $params = ['username' => $user, 'password' => $password, 'hostspec' => $host, 'port' => $port, 'secure' => $ssl_mode, 'timeout' => 20]; if ($this->config->getSystemValue('app.mail.imaplog.enabled', false)) { $params['debug'] = $this->config->getSystemValue('datadirectory') . '/horde.log'; } if ($this->config->getSystemValue('app.mail.server-side-cache.enabled', false)) { if ($this->memcacheFactory->isAvailable()) { $params['cache'] = ['backend' => new Cache(array('cacheob' => $this->memcacheFactory->create(md5($this->getId() . $this->getEMailAddress()))))]; } } $this->client = new \Horde_Imap_Client_Socket($params); $this->client->login(); } return $this->client; }