Horde_ActiveSync_Imap_Adapter::getMessages PHP Method

getMessages() public method

Return AS mail messages, from the given IMAP UIDs.
public getMessages ( string $folderid, array $messages, array $options = [] ) : array
$folderid string The mailbox folder.
$messages array List of IMAP message UIDs
$options array Additional Options: - truncation: (integer) The truncation constant, if sent from device. DEFAULT: false (No truncation). - bodyprefs: (array) The bodypref settings, if sent from device. DEFAULT: none (No body prefs sent, or enforced). - bodypartprefs: (array) The bodypartprefs settings, if present. - mimesupport: (integer) Indicates if MIME is supported or not. Possible values: 0 - Not supported 1 - Only S/MIME or 2 - All MIME. DEFAULT: 0 (No MIME support) - protocolversion: (float) The EAS protocol version to support. DEFAULT: 2.5
return array An array of Horde_ActiveSync_Message_Mail objects.
    public function getMessages($folderid, array $messages, array $options = array())
    {
        $mbox = new Horde_Imap_Client_Mailbox($folderid);
        $results = $this->_getMailMessages($mbox, $messages, array('headers' => true, 'envelope' => true));
        $ret = array();
        foreach ($results as $data) {
            if ($data->exists(Horde_Imap_Client::FETCH_STRUCTURE)) {
                try {
                    $ret[] = $this->_buildMailMessage($mbox, $data, $options);
                } catch (Horde_Exception_NotFound $e) {
                }
            }
        }
        return $ret;
    }

Usage Example

Example #1
0
 public function testBug13711()
 {
     $this->markTestIncomplete("Useless test without all the fixtures.");
     $factory = new Horde_ActiveSync_Factory_TestServer();
     $imap_client = $this->getMockSkipConstructor('Horde_Imap_Client_Socket');
     $imap_client->expects($this->any())->method('fetch')->will($this->_getFixturesFor13711());
     $imap_factory = new Horde_ActiveSync_Stub_ImapFactory();
     $imap_factory->fixture = $imap_client;
     $adapter = new Horde_ActiveSync_Imap_Adapter(array('factory' => $imap_factory));
     $adapter->getMessages('INBOX', array(462), array('protocolversion' => 14.1, 'bodyprefs' => array('wanted' => Horde_ActiveSync::BODYPREF_TYPE_MIME, Horde_ActiveSync::BODYPREF_TYPE_MIME => array('type' => Horde_ActiveSync::BODYPREF_TYPE_MIME, 'truncationsize' => 200000)), 'mimesupport' => Horde_ActiveSync::MIME_SUPPORT_ALL));
 }
All Usage Examples Of Horde_ActiveSync_Imap_Adapter::getMessages