ZF-9138: Add sort() to Zend_Mail_Storage_Imap

Issue Type: New Feature Created: 2010-02-11T02:36:22.000+0000 Last Updated: 2012-11-20T21:38:00.000+0000 Status: Open Fix version(s): Reporter: Michael Kliewe (mkliewe) Assignee: None Tags: - Zend_Mail_Storage

Related issues: Attachments:


It should be possible to get a list of sequence numbers sorted by a criterion. This is only supported by imap servers that provide the SORT capability.

In Storage_Imap there should be something like this:

<pre class="highlight">/**
 * get sequence ids sorted by a criterion
 * @param string $sortBy
 * @return array
public function listSorted($sortBy = null)
    $params = array($sortBy, 'utf-8', 'ALL');
    return $this->_protocol->sort($params);

In Protocol_Imap then

<pre class="highlight">/**
 * do a sort request
 * @internal
 * @return array message sequence ids
public function sort(array $params)
    $response = $this->requestAndResponse('SORT', $params);
    if (!$response) {
        return $response;
        foreach ($response as $ids) {
        if ($ids[0] == 'SORT') {
            return $ids;
    return array();

This should do the trick.


No comments to display

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.