src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php
public function listUniqueIdentifiers( $msgNum = null )
    {
        if ( $this->state != self::STATE_SELECTED &&
             $this->state != self::STATE_SELECTED_READONLY )
        {
            throw new ezcMailTransportException( "Can't call listUniqueIdentifiers() on the IMAP transport when a mailbox is not selected." );
        }

        $result = array();
        if ( $msgNum !== null )
        {
            $tag = $this->getNextTag();
            $this->connection->sendData( "{$tag} UID SEARCH {$msgNum}" );
            $response = $this->getResponse( '* SEARCH' );
            if ( strpos( $response, '* SEARCH' ) !== false )
            {
                $result[(int)$msgNum] = trim( substr( $response, 9 ) );
            }
            $response = trim( $this->getResponse( $tag, $response ) );
        }
        else
        {
            $uids = array();
            $messages = array_keys( $this->listMessages() );
            $tag = $this->getNextTag();
            $this->connection->sendData( "{$tag} UID SEARCH UNDELETED" );
            $response = $this->getResponse( '* SEARCH' );
            if ( strpos( $response, '* SEARCH' ) !== false )
            {
                $response = trim( substr( $response, 9 ) );
                if ( $response !== "" )
                {
                    $uids = explode( ' ', $response );
                }
                for ( $i = 0; $i < count( $messages ); $i++ )
                {
                    $result[trim( $messages[$i] )] = $uids[$i];
                }
            }
            $response = trim( $this->getResponse( $tag ) );
        }
        if ( $this->responseType( $response ) != self::RESPONSE_OK )
        {
            throw new ezcMailTransportException( "The IMAP server could not fetch the unique identifiers: {$response}." );
        }
        return $result;
    }
public function listUniqueIdentifiers( $msgNum = null )
    {
        if ( $this->state != self::STATE_SELECTED &&
             $this->state != self::STATE_SELECTED_READONLY )
        {
            throw new ezcMailTransportException( "Can't call listUniqueIdentifiers() on the IMAP transport when a mailbox is not selected." );
        }

        $result = array();
        if ( $msgNum !== null )
        {
            $tag = $this->getNextTag();
            $this->connection->sendData( "{$tag} UID SEARCH {$msgNum}" );
            $response = $this->getResponse( '* SEARCH' );
            if ( strpos( $response, '* SEARCH' ) !== false )
            {
                $result[(int)$msgNum] = trim( substr( $response, 9 ) );
            }
            $response = trim( $this->getResponse( $tag, $response ) );
        }
        else
        {
            $uids = array();
            $messages = array_keys( $this->listMessages() );
            $tag = $this->getNextTag();
            $this->connection->sendData( "{$tag} UID SEARCH UNDELETED" );
            $response = $this->getResponse( '* SEARCH' );
            if ( strpos( $response, '* SEARCH' ) !== false )
            {
                $response = trim( substr( $response, 9 ) );
                if ( $response !== "" )
                {
                    $uids = explode( ' ', $response );
                }
                for ( $i = 0; $i < count( $messages ); $i++ )
                {
                    $result[trim( $messages[$i] )] = $uids[$i];
                }
            }
            $response = trim( $this->getResponse( $tag ) );
        }
        if ( $this->responseType( $response ) != self::RESPONSE_OK )
        {
            throw new ezcMailTransportException( "The IMAP server could not fetch the unique identifiers: {$response}." );
        }
        return $result;
    }
public function listUniqueIdentifiers ( $ msgNum = null ) { if ( $ this -> state != self :: STATE_SELECTED && $ this -> state != self :: STATE_SELECTED_READONLY ) { throw new ezcMailTransportException ( "Can't call listUniqueIdentifiers() on the IMAP transport when a mailbox is not selected." ) ; } $ result = array ( ) ; if ( $ msgNum !== null ) { $ tag = $ this -> getNextTag ( ) ; $ this -> connection -> sendData ( "{$tag} UID SEARCH {$msgNum}" ) ; $ response = $ this -> getResponse ( '* SEARCH' ) ; if ( strpos ( $ response , '* SEARCH' ) !== false ) { $ result [ ( int ) $ msgNum ] = trim ( substr ( $ response , 9 ) ) ; } $ response = trim ( $ this -> getResponse ( $ tag , $ response ) ) ; } else { $ uids = array ( ) ; $ messages = array_keys ( $ this -> listMessages ( ) ) ; $ tag = $ this -> getNextTag ( ) ; $ this -> connection -> sendData ( "{$tag} UID SEARCH UNDELETED" ) ; $ response = $ this -> getResponse ( '* SEARCH' ) ; if ( strpos ( $ response , '* SEARCH' ) !== false ) { $ response = trim ( substr ( $ response , 9 ) ) ; if ( $ response !== "" ) { $ uids = explode ( ' ' , $ response ) ; } for ( $ i = 0 ; $ i < count ( $ messages ) ; $ i ++ ) { $ result [ trim ( $ messages [ $ i ] ) ] = $ uids [ $ i ] ; } } $ response = trim ( $ this -> getResponse ( $ tag ) ) ; } if ( $ this -> responseType ( $ response ) != self :: RESPONSE_OK ) { throw new ezcMailTransportException ( "The IMAP server could not fetch the unique identifiers: {$response}." ) ; } return $ result ; }
Returns the unique identifiers for the messages from the current mailbox.

You can fetch the unique identifier for a specific message by
providing the $msgNum parameter.

The unique identifier can be used to recognize mail from servers
between requests. In contrast to the message numbers the unique
numbers assigned to an email usually never changes.

The format of the returned array is:
<code>
array( message_num => unique_id );
</code>

Example:
<code>
array( 1 => 216, 2 => 217, 3 => 218, 4 => 219 );
</code>

Before calling this method, a connection to the IMAP server must be
established and a user must be authenticated successfully, and a mailbox
must be selected.

@todo add UIVALIDITY value to UID (like in POP3) (if necessary).

@throws ezcMailTransportException
if a mailbox is not selected
or if the server sent a negative response
@param int $msgNum
@return array(string)
Returns the unique identifiers for the messages from the current mailbox .