Hi Ralf,
Thank you very much for your prompt and helpful response. As always, your support and the transparency of EGroupware’s architecture are greatly appreciated. We took some time to analyze the code more deeply, and while we are certainly not experts we’d like to share some observations.
Looking at the createIMAPFilter() function in api/src/Mail.php, it appears that the search string is not passed directly to the IMAP server as a raw query, but rather gets wrapped into a specific search criterion based on the selected search type.
For example, when we search for “hospital project” with the Subject filter, the actual IMAP query becomes:
SUBJECT "hospital project"
This means the IMAP server searches for emails containing the exact substring “hospital project” in the subject line.
The practical limitation:
This creates some challenges in daily operations, especially with large mailboxes:
Exact substring matching: If I’m looking for emails about a hospital project but I type “Hospita” (missing the final “l”), I won’t find “Hospital” - the search requires the exact substring.
Word order matters: Searching for “New hospital” won’t find an email with subject “Hospital new project” because IMAP substring matching is sequential.
No logical operators: We cannot search for emails that contain “hospital” AND “budget” in the subject, or emails from “mario” OR “luigi”. The search is limited to a single substring.
Technical observation:
We verified that our IMAP server (Dovecot) fully supports RFC 3501 search capabilities, including:
OR SUBJECT “term1” SUBJECT "term2"
SUBJECT “term1” FROM “term2” (implicit AND)
NOT SEEN
Combined criteria
We also noticed that Horde_Imap_Client_Search_Query (which EGroupware uses) does support these advanced queries through methods like orSearch(), andSearch(), and flag(). In fact, the quicksearch already uses orSearch() to combine SUBJECT and FROM criteria.
Would it be very useful if email interprets the search syntax already used in other EGroupware applications
For example:
hospital budget → OR search (contains “hospital” OR “budget”)
hospital +budget → AND search (contains both)
hospital -draft → NOT search (contains “hospital” but NOT “draft”)
This would align mail search behavior with other EGW apps (Addressbook, Calendar, InfoLog) and leverage the IMAP capabilities that are already available through Horde.
Thank you again for your time and for maintaining such a transparent and well-documented project. EGroupware’s adherence to open standards (CardDAV, CalDAV, IMAP) is one of its greatest strengths, and we believe this enhancement would further improve the user experience.
Best regards,
Gabriele