Searching and Filtering
Aid4Mail’s powerful search and filter features allow you to include or exclude emails, non-email items or whole folders from your target mailbox based on specific search criteria. Note that, in trial mode, Aid4Mail works on modified copies of your mail which may, in turn, impact your filter results. For more details see the Trial mode topic in the help file.
All Aid4Mail editions can search and filter folders. Aid4Mail Enterprise and Investigator extend search and filter capabilities to individual emails (and non-email items), their attachments and even files contained within attachments. They can also perform native searches and enable you to write your own filters with Python filter scripts.
Aid4Mail applies filters in they order they appear in the Filter section of the Settings screen: First the folder or native filter, next the item filter and finally any Python filter script that is set. For details, please refer to the Filter order topic.
Aid4Mail filters consist of one or more search terms (except Python filter scripts which use a different syntax). During processing, items that match your search terms will be included in your target mail. Those that don’t will be excluded. Search terms must adhere to specific rules and can include:
- Regular expressions
- Search operators
- Boolean operators
For more information, please refer to the Search terms topic in the help file.
Tutorial on searching and filtering
The example below walks you through the basics of searching and filtering with Aid4Mail. It uses Aid4Mail Investigator which, along with Aid4Mail Enterprise, has access to all of the search and filter capabilities (Aid4Mail Converter is limited to searching and filtering folders).
If you don’t have a license for Aid4Mail Investigator, you can still follow this example by running Aid4Mail Investigator in trial mode. The trial is totally free and will not affect any other Aid4Mail license you may have. To do this, select File > Change edition > Aid4Mail Investigator Trial from the main menu. Once you’ve finished testing Aid4Mail Investigator, you can use the same menu option to change the edition back again.
Note that in trial mode, Aid4Mail works on modified copies of your mail which may impact your filter results. For more details see the Trial mode topic in the help file.
Let’s say you only want to process emails sent to firstname.lastname@example.org in the first quarter of 2018, that include either the keywords vacation or Bahamas (or both) and the phrase travel agent, and are still in the Inbox folder. Breaking this down into its constituent parts, the targeted emails must match the following criteria:
- Sent to email@example.com.
- Sent in first quarter of 2018.
- Include the word vacation or Bahamas or both.
- Include the phrase travel agent.
- Are still in the Inbox folder.
The ordering of filters is important so, first, you need to know what is being searched for at the folder level and what is at the item (email) level. Looking through the requirements, number 5 is the only folder search and the rest are all item searches.
There's a couple of ways to approach a folder search: You can either select the required folder(s) in the folder tree or use folder search terms.
Select folders in the folder tree
In the Folder or native filter section of the Filter settings, choose the Select in folder tree option. Aid4Mail will display your folder tree with everything selected. Click the topmost folder to deselect all folders. Then select only the Inbox folder.
Use folder search terms
You can accomplish the same thing using Folder search terms. Select this option and then in the search box write inbox as shown below:
The search term you just created tells Aid4Mail to only include emails that are in the Inbox folder. All other folders will be excluded.
In the Item search terms field, enter the following:
To:firstname.lastname@example.org SentAfter:2017 SentBefore:2018-05 (vacation OR bahamas) "travel agent"
Again, you can write the search terms directly or use the search assistant.
Any space between search terms, where no Boolean operator is specified, uses an AND operator by default. So this search is equivalent to:
To:email@example.com AND SentAfter:2017 AND SentBefore:2018-05 AND (vacation OR bahamas) AND "travel agent"
Let’s now go through the search terms one by one.
This tells Aid4Mail to only include emails sent to the address firstname.lastname@example.org.
Note that search operators are case-insensitive. So writing To or to makes no difference.
If you wanted to include Mary’s emails too, you would write To:(email@example.com OR firstname.lastname@example.org) or, alternatively, To:email@example.comfirstname.lastname@example.org.
If you wanted to search for mail sent to anyone at the company, you would use a wildcard.
For example, using the * character wildcard to make the search term To:*@aid4mail.com,
would find emails sent to any address within the aid4mail.com domain.
Aid4Mail will only include emails sent after the date specified. In this example, only the year has been specified. The month could have been added too, SentAfter:2017-12, and the day, SentAfter:2017-12-31, but they aren’t required in this case. Note that the date is specified in the International date format: YYYY-MM-DD.
This time specifying the month is necessary to get the correct results based on our example.
(vacation OR bahamas)
This is a case where the Boolean operator must be explicitly specified. If there had just been a space between the two keywords, (vacation bahamas), an AND operator would automatically be applied, (vacation AND bahamas), which is not what is wanted. The requirements state that emails containing either of those words (or both) are to be included so the OR is necessary.
Note that the two keywords are written lowercase. Case only makes a difference when Smart case detection for item search terms is turned on. It’s off by default, making the search case-insensitive, but let’s assume that for this example it’s on. Then using uppercase letters in a keyword makes the search for that word case-sensitive. So if the keyword had been written as Bahamas, only that exact word would be found. Any variation, such as BAHAMAS or bahamas, would be excluded from the results. Specifying the keyword in lowercase makes the search case-insensitive, so bahamas, Bahamas, BAHAMAS, bAhAmAs or any other variation in case would be included in the results. Turning Smart case detection for item search terms off also makes the search case-insensitive, and for all search terms.
Parentheses are required here due to the order of precedence of Boolean operators whereby AND operators take precedence over OR operators. As parentheses take precedence over all Boolean operators, their presence ensures that (vacation OR bahamas) will be treated as a group.
The quotes here tell Aid4Mail to look for an exact phrase. So only these two words together will be found, in this order, as they’re written. Emails with the phrase travel and transport agent, for example, would be excluded. Case sensitivity again depends on Smart case detection for item search terms.
If the quotes were removed, the search term would become travel agent which is the same as travel AND agent (because a space with no operator automatically becomes an AND operator). This would then include emails containing travel and transport agent and even agent for travel. In fact it would include any email that contains both of the words, no matter their order, location in the email or proximity to each other, which is not what is wanted in this example.
Hopefully this has given you an overview of Aid4Mail’s powerful search and filter capabilities. There’s much more you can do that has not been covered here, like proximity searching, deduplicating and searching unpurged mail. For more information on all the available search operators and other syntactic details, please refer to the Search terms topic in the help file. If you are interested in searching and filtering with Python scripts, which are extremely powerful but more advanced, please refer to the Python scripts topic in the help file.
If you experience any issues, please don't hesitate to contact us.
If you would like to buy an Aid4Mail license, please visit the Aid4Mail website.