[horde] Sorting Emails

Michael J Rubinsky mrubinsk at horde.org
Thu Feb 9 16:03:57 UTC 2017


Quoting Mike Poznecki <poz_sa at yahoo.com>:

> I want to sort my email by a field that is different than what is  
> allowed.  According to the php website:

PHP's documentation of for PHP's imap extension. This is an  
*extremely* inefficient imap client that is basically a wrapper around  
the old and outdated c-client library. Horde has written it's own imap  
client library that takes advantage of features of modern IMAP servers  
that are more suited for the web-mail use case.

>
> Criteria can be one (and only one) of the following:
>    - SORTDATE - message Date
>    - SORTARRIVAL - arrival date
>    - SORTFROM - mailbox in first From address
>    - SORTSUBJECT - message subject
>    - SORTTO - mailbox in first To address
>    - SORTCC - mailbox in first cc address
>    - SORTSIZE - size of message in octets

See the phpdoc for Horde_Imap_Client_Base::search() for a list of sort  
criteria supported by the IMAP protocol.


> But I would like to sort by a different field.  So my questions are these:
> 1. When the emails are read from the server, are they cached in a  
> place that I can then sort?

Sorting takes place on the IMAP server before the results are  
transmitted to Horde whenever possible. Depending on the sort criteria  
requested, this *may* fallback to client side sorting of the requested  
field if the IMAP server does not support the required extension. See  
Horde_Imap_Client_Socket::_search() and  
Horde_Imap_Client_Socket_ClientSort::.

>  If so, are all emails brought back and cached?  If so, where in the  
> code can I look to find where to start making my changes?
> 2. Is there some other way to implement a sort when calling the IMAP server? 

If your desired sort field is not one of those listed in  
Horde_Imap_Client_Base::search(), then you will have to hack the code,  
adding the necessary logic in all of the places (and possibly more)  
mentioned above.

> 3. Why does Horde pass in "DISPLAYFROM"?  I cannot find anywhere in  
> the IMAP docs that references that.

See answer above. This is one of the supported fields.



> Horde mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: horde-unsubscribe at lists.horde.org



-- 
mike
The Horde Project
http://www.horde.org
https://www.facebook.com/hordeproject
https://www.twitter.com/hordeproject
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3282 bytes
Desc: S/MIME Signature
URL: <https://lists.horde.org/archives/horde/attachments/20170209/2b452d53/attachment.bin>


More information about the horde mailing list