Details
-
Type:
New Feature
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 1.9.7
-
Fix Version/s: None
-
Component/s: Zend_Mail_Storage
-
Labels:None
Description
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:
/** * 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 http://tools.ietf.org/html/rfc3501#page-49 ). 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.
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.