_debug) { print "connecting to $host, authenticating as $username and selecting $folder\n"; } $options = array('ssl' => $ssl, 'uidReferencing' => TRUE); $this->_transport = new ezcMailImapTransport($host, NULL, $options); $this->_transport->authenticate($username, $password); $this->_transport->selectMailbox($folder); $this->_ignored = implode($this->_transport->getHierarchyDelimiter(), array($folder, 'CiviMail', 'ignored')); $this->_processed = implode($this->_transport->getHierarchyDelimiter(), array($folder, 'CiviMail', 'processed')); $boxes = $this->_transport->listMailboxes(); if ($this->_debug) { print 'mailboxes found: ' . implode(', ', $boxes) . "\n"; } if (!in_array(strtolower($this->_ignored), array_map('strtolower', $boxes))) { $this->_transport->createMailbox($this->_ignored); } if (!in_array(strtolower($this->_processed), array_map('strtolower', $boxes))) { $this->_transport->createMailbox($this->_processed); } } /** * Expunge the messages marked for deletion, CRM-7356 */ function expunge() { $this->_transport->expunge(); } /** * Move the specified message to the ignored folder * * @param integer $nr number of the message to move * * @return void */ function markIgnored($nr) { if ($this->_debug) { print "setting $nr as seen and moving it to the ignored mailbox\n"; } $this->_transport->setFlag($nr, 'SEEN'); $this->_transport->copyMessages($nr, $this->_ignored); $this->_transport->delete($nr); } /** * Move the specified message to the processed folder * * @param integer $nr number of the message to move * * @return void */ function markProcessed($nr) { if ($this->_debug) { print "setting $nr as seen and moving it to the processed mailbox\n"; } $this->_transport->setFlag($nr, 'SEEN'); $this->_transport->copyMessages($nr, $this->_processed); $this->_transport->delete($nr); } }