ZF-8858: Add search() to Zend_Mail_Storage_Imap

Issue Type: New Feature Created: 2010-01-18T07:01:02.000+0000 Last Updated: 2012-11-20T21:37:24.000+0000 Status: Open Fix version(s): Reporter: Michael Kliewe (mkliewe) Assignee: None Tags: - Zend_Mail_Storage

Related issues: Attachments:


There already is a search() function in Zend_Mail_Protocol_Imap, but it is only used for countMessages() at the moment.

It would be nice to have a search() function in Zend_Mail_Storage_Imap, so we can search the current folder for mails.

Should be very easy, for example this does the job:

<pre class="highlight">
 * get IDs by full body search on IMAP server
 * @param string $searchterm
 * @return array
public function search($searchterm)
    $params = array('BODY ' . $searchterm);
    return $this->_protocol->search($params);

It would be cool to not only do a full BODY search but also search in specific parts, for example build a complex filter (see RFC 3501 ). Then building a filter similar to Zend_Ldap_Filter would be perfect.

But in the first version just a simple full BODY search would be a beginning.


Posted by Nico Edtinger (nico) on 2010-04-09T09:41:30.000+0000

My idea was to have a class, let's call it Zend_Mail_Storage_Set, supporting UIDs, ranges, search, sort, ... An instance of a storage class would have a method set(), which returns a set instance (common or specialized for this storage). A couple of features are not IMAP specific and it wouldn't make sense to just add a new method for one storage.

Zend_Mail_Storage_Set would implement an iterator interface and instead of getting just an id or UID you could also fetch the corresponding message. I have an old mail with a couple of use cases.

Posted by Michael Kliewe (mkliewe) on 2010-04-09T10:05:02.000+0000

Sounds good as long as it is fast. For example if you want to retrieve messages with UID 1-5, it should only call one IMAP command and not 5. The same for moving messages, deleting messages and so on. See also my other issues ZF-9138 ZF-8513 ZF-8488

Have you found an issue?

See the Overview section for more details.


© 2006-2022 by Zend by Perforce. Made with by awesome contributors.

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