Opened 11 years ago

Last modified 7 days ago

#5141 new enhancement

Generating queries for related mails in Mail

Reported by: humdinger Owned by: bga
Priority: normal Milestone: R1.1
Component: Applications/Mail Version:
Keywords: Cc:
Blocked By: Blocking: #1208
Platform: All

Description (last modified by nielx)

This ticket is the result of discussions on the dev mailing list and cdt mailing list.

The idea behind this ticket is to integrate queries with the Mail application.
Often when reading a mail, you're interested in all mails with the same subject (thread) or the same sender (or, when writing a mail, the same recipient). Sometimes it's also useful to limit the search to a certain timeframe (mostly when querying a very active sender).
Creating a query for those is unnecessarily cumbersome. As the currently open mail already has all the needed info, launching a query (via Tracker scripting?) from within Mail makes sense.

We already have a (non-working) Queries menu (ticket #1208) and could use an additional Queries toolbar button (which is not strictly necessary, but users relying on the toolbar would also want to access queries from there, I imagine).
Another option is to also provide a context menu on header information, so a right-click on e.g. the sender would show the below discussed menu item (here: "Same Sender... >") in addition to other options, like "Copy to Clipboard", "Add New People File" (if it doesn't already exist) etc.

The queries menu

 |                        |
 | Same Subject...      > |
 | Same Sender...       > |
 | Same Mailing List... > |
 | Same Status...       > |
 | All in Timeframe     > |
 | { User Query 1 }...  > |
 | { User Query 2 }...  > |
 | { User Query 3 }...  > |
 | { User Query 4 }...  > |
 | Edit User Queries...   |

What exact queries will be provided remains to be discussed. "Same Mailing List" appears only if the To:-field and your Account:-field don't match - a sign of a mailing list. The menu also changes when writing a new mail: here "Same Sender" is replaced with "Same Recipient".

Besides the default queries, you can add user queries which are any query you put in "~/config/settings/Mail/User Queries". Only the empty attribute fields of those queries are replaced with the corresponding values of the current mail. Filled in values will remain untouched.
That way more complex queries can be used, like "Same Subject && Same Sender" or "Same Sender && Subject!="*[haiku-commits]*"".

Every menu item has a submenu to optionally limit the query to a certain timeframe.
You don't have to enter the submenu, if you just click on "Same Subject..." the query starts immediately showing all mail of that subject without timeframe limit. ("All in Timeframe" being the exception, of course...). This is similar to the "Open... >" menu in other apps, that provide a submenu with recent documents, but show the open file dialog when just clicking the menu item.

The timeframe submenu

 |                     ___|_______________
 | Same Subject...    |_____Timeframe_____|
 | Same Sender...     |                   |
 | Same Mailing List..| Since 4 hours   > |
 | Same Status...     | Today           > |
 |--------------------| Since 3 days    > |
 | All in Timeframe   | Since 2 weeks   > |
 |--------------------| Since 6 months  > |
 | { User Query 1 }...|___________________|
 | { User Query 2 }...  > |
 | { User Query 3 }...  > |
 | { User Query 4 }...  > |
 | Edit User Queries...   |

The timefame submenu of every menu item only provides Today and the units hours/days/weeks/months. The value is set in the next deeper submenu. These values are remembered for each menu item.

I expect a user to mostly reuse the once set value as it's only meant to roughly limit the timeframe of his query results.

The value submenu

 |                     ___|_______________
 | Same Subject...    |_____Timeframe_____|
 | Same Sender...     |                   |
 | Same Mailing List..| Since 4 hours   >_|_
 | Same Status...     | Today          | 1 |
 |--------------------| Since 3 days   | 2 |
 | All in Timeframe   | Since 2 weeks  | 3 |
 |--------------------| Since 6 months | 4 |
 | { User Query 1 }...|________________| 5 |
 | { User Query 2 }...  > |            |_6_|
 | { User Query 3 }...  > |            
 | { User Query 4 }...  > |            
 | Edit User Queries...   |

Depending on the unit, more or fewer values should be provided.

  • hours: 1,2,3,4,5,6,9,12 (then you can switch to today)
  • days: 1,2,3,4,5,6 (then you can switch to week)
  • weeks: 1,2,3 (then you can switch to month)
  • months: 1,2,3,6,12 (then you'll skip the timeframe altogether)

Fuzzy Query

Before the query string is generated, it should be "fuzzied". For example:

If the from-field is "Stephan Assmus <superstippi@…>" the query should be for "Stephan Assmus" || "superstippi@…".
If the subject is "[haiku-3rdparty-dev] Re: Capturing the "NTCH" message" it should be stripped to a significant part "Capturing the "NTCH" message". So, for example, everything in front of and including a "Re:" or "Fwd:" and other possibly localized abbreviations generated by some mail client, is replaced with a "*".
Plus, any special characters that apparently happen to be inserted, have to be cleaned first.

Change History (6)

comment:1 by nielx, 11 years ago

Description: modified (diff)

Fix links in description. Note: there cannot be newlines between the brackets [].

comment:2 by humdinger, 10 years ago

A "slightly" less ambitious approach is described in #1208.

comment:3 by zuMi, 9 years ago

Some time ago I've done a yab application that does similar things but without menus, it uses checkboxes to do multiple search, as u can see on

but the "time frame" feature is blocked by this

and this works only on R5

comment:4 by waddlesplash, 22 months ago

First part of this done in hrev52663.

comment:5 by waddlesplash, 21 months ago

Blocking: 1208 added

comment:6 by pulkomandy, 7 days ago

Milestone: R1R1.1
Note: See TracTickets for help on using tickets.