Horde_ActiveSync_Imap_Adapter::getImapMessage PHP Method

getImapMessage() public method

Return a complete Horde_ActiveSync_Imap_Message object for the requested uid.
public getImapMessage ( string $mailbox, array | integer $uid, array $options = [] ) : array
$mailbox string The mailbox name.
$uid array | integer The message uid.
$options array Additional options: - headers: (boolean) Also fetch the message headers if this is true. DEFAULT: false (Do not fetch headers).
return array An array of Horde_ActiveSync_Imap_Message objects.
    public function getImapMessage($mailbox, $uid, array $options = array())
    {
        if (!is_array($uid)) {
            $uid = array($uid);
        }
        $mbox = new Horde_Imap_Client_Mailbox($mailbox);
        // @todo H6 - expand the $options array the same as _getMailMessages()
        // for now, always retrieve the envelope data as well.
        $options['envelope'] = true;
        $messages = $this->_getMailMessages($mbox, $uid, $options);
        $res = array();
        foreach ($messages as $id => $message) {
            if ($message->exists(Horde_Imap_Client::FETCH_STRUCTURE)) {
                $res[$id] = new Horde_ActiveSync_Imap_Message($this->_getImapOb(), $mbox, $message);
            }
        }
        return $res;
    }

Usage Example

Example #1
0
File: Mdn.php Project: horde/horde
 /**
  * Check to see if we are able to send an unconfirmed MDN based on the
  * message data.
  *
  * @return boolean  True if able to send, otherwise false.
  */
 protected function _msgCheck()
 {
     $msgs = $this->_imap->getImapMessage($this->_mailbox, $this->_uid, array('headers' => true));
     if (!count($msgs)) {
         return false;
     }
     $imap_msg = array_pop($msgs);
     $mdn = new Horde_Mime_Mdn($imap_msg->getHeaders());
     if ($mdn->getMdnReturnAddr() && !$mdn->userConfirmationNeeded()) {
         $this->_msg = $imap_msg;
         return true;
     }
     return false;
 }
All Usage Examples Of Horde_ActiveSync_Imap_Adapter::getImapMessage