Email filters help you to better manage your emails. For example, you can find all emails you receive about a certain project in the relevant folder simply by creating a filter rule to move any message with a subject containing the project’s name to the correct folder. Similarly, you can define spam filter rules to keep the junk mails away from your inbox. This way you can make sure your inbox is clean and well organized, therefore you’ll spend far less time manually cleaning up your email inbox and more time being more productive. Another useful usage of email filters would be applying tags to emails and forwarding mail messages. A less common use of email filters is to inspect the outgoing emails. For example, to ensure that outgoing emails comply with the appropriate rules and policies of a company.
Generally speaking, an email filter is a program that performs a specific action based on specific conditions. For example, it can separate the incoming emails into different folders based on the address they have been sent from. In this example, the action is moving emails into different folders and the condition would be the sender addresses.
Email filters primarily help in managing, categorizing, and organizing the incoming email messages and removing spam, collateral spam, and viruses based on your specific needs. The emails can be classified by different conditions such as sender’s address, subject, or message content. Put it simply, with email filters you can create matching rules to filter your email messages, both for incoming messages and emails you’ve already received.
How to Add Filters in Zimbra
To add a filter
- Go to the Preferences tab on the main toolbar
- Click the Filters on the left to open the filters window
- Select Incoming Message Filters or Outgoing Message Filters
- Click the Create Filter button
- In the Filter Name field enter a name for the filter
- Leave the Active checkbox checked if you want this filter to work after adding the filter, or otherwise uncheck it
- Click the dropdown menu in front of If and select either any or all
- Click the left dropdown menu in the conditions box and select the desired comparison field
- Click on the next dropdown menu and select the desired comparison operator
- In the blank box, enter the text or number to be used to compare with that of incoming messages
- Click the + button if you need to create additional conditions
- Click the dropdown menu under the Perform the following actions and select the desired action to be executed (some actions require an additional field to fill in)
- Click the + button if you need to create additional actions
- Check Do not process additional filters, if this is the only filter to be run on messages that meet the conditions of this filter. The Do not process additional filters action should be the last action within each filter rule. This prevents the application of any additional filter rules to email messages that match the current rule
- Leave the Do not process additional filters checkbox checked if this is the only filter to be run on messages that meet the conditions of this filter
- Click OK.
*The screenshots show the Zimbra OSE interface with the Zextras Theme.
How to Construct a Filter Rule
In Zimbra, a filter rule consists of one or more conditions and one or more actions. The actions will be triggered when an email message meets the conditions. A filter rule can contain one or more conditions. For example, if someone sends you email messages from more than one email addresses and you want to direct all the messages from the person into one folder, you can create one filter that has two conditions, one for each email address, and one action to move the email messages to the same folder.
The order of the conditions is not important. You can choose whether the email message must match all conditions or just meet any one of the listed conditions. You can also use a negative condition. For example, you can filter an email message that does not contain a particular word. Conditions are not case-sensitive.
You can also choose multiple actions from moving the emails to specific folders, tag or marking them, delete, or redirect them, although in multiple actions the order is important. The actions are executed in the order of their appearance. Changes to filter rules are saved immediately and the filter will be applied automatically to all new incoming mail messages as they arrive. However, filters can be also applied to the existing emails by running the filter against a specific folder.
Constructing a filter rule consists of three main parts as follows. First, you should select that if all the conditions must be met or even satisfying one of the conditions would be enough for the filter to trigger the action. Then you must define the conditions based on your needs. Finally, you should select your preferred actions in the order you need them to be executed. In the following, you can see these steps in detail.
1. Any or All
The first step of constructing a filter rule is to select either any or all of the conditioned must be met in order for actions to be triggered.
- Any means that if an email message meets at least one of the conditions, apply the action.
- All means that if an email message meets all of the conditions, apply the action.
The next step is to define a Condition. To define a condition you first need to specify a comparison field. The Comparison field indicates where to look in an email message in order to compare it with the condition.
Comparison fields can be one of the following options
- From looks for the specified words in the From header.
- To looks for the specified words in the To header.
- Cc looks for the specified words in the Cc header.
- To or Cc looks for the specified words in both To and Cc header.
- Subject looks for specific words in the Subject header.
- Message looks for message properties like if it’s flagged.
- Size looks for messages larger or smaller than a specified size.
- Date looks for messages sent before or after a specified date.
- Body looks for the specified words in the body of the email.
- Attachment looks for messages with or without attachments.
- Read Receipt looks for messages with or without read receipt.
- Address In looks for the specified address in your contacts.
- Calendar looks for calendar-related messages.
- Social looks for LinkedIn, Twitter, and Facebook-related messages.
- Header Named looks for header-related properties of messages.
After specifying the comparison field, you need to specify a comparison operator. The comparison operator indicates who to compare an email message with the specified comparison field. The comparison operator can vary based on the needs of the comparison fields you have chosen.
Comparison operators can be one of the following options
- matches exactly – does not match exactly specifies an exact match.
- contains – does not contain specifies that the subject line must contain the specified substring.
- matches wildcard condition or does not match wildcard condition specifies that the subject must match the specified string, which includes wildcards.
- is – is not used for comparison against the Message field.
- under – not under – over – not over specifies the size and the unit of measurement B, KB, MB, GB.
- before – not before – after – not after used for comparison against the Date field.
- exists – does not exist specifies that the specified comparison field must exist or must not exist in the message.
- From – To – Cc – To or Cc – in – not in – is me – is not me used in Address in field to check if an address appearing in a field of incoming messages such as From, To, Cc, and Bcc is or is not you or in one of the Contacts or My Frequent Emails.
- invite is requested – invite is not requested – invite is replied – invite is not replied used for Calendar field.
- LinkedIn messages and connections – Twitter notifications – Facebook notifications used for Social field.
Note these examples,
- Matches exactly means that the specified line must match the specified string. For example, specifying the subject matches exactly “Banana would” only match “Banana” and not “Bananas” or “A truck full of banana leaves”.
- Contains means that the specified line must contain, somewhere within it, the specified string. For example, specifying that the subject line contains “bananas” would match both “Cooking with bananas” and “Bananas for breakfast”.
- Matches wildcard condition specifies that the subject must match the specified string, which includes wildcards. For example, specifying “bana*” would match “banana” and “banana tree” but not “free bananas”.
- Is means that the specified line must exactly match the specified string, with no wildcards or substitutions. For example, specifying that the subject is “bananas” would only match “bananas” and not “Banana”, “My bananas”, or “Bananas?”.
Wildcards: Comparisons operators that use the matches wildcard condition and does not match wildcard condition, can use wildcards to define more flexible matching patterns. The two wildcard characters are * and ?, and \ is the escape character.
- Asterisk (*) – The asterisk is a placeholder for “zero or more characters of any type”. For example, the string “banana*float” matches with “bananafloat”, “bananas”, “banana-leaf casserole float” but not “super-banana-float”, or “w*bandanna” matches with “white bandanna” or “whose bandanna” but not “whose bandanna is this?”.
- Question mark (?) – The question mark is a placeholder for “exactly one character”. For example, the string “banana?boat” matches with “bananasboat”, “banana-boat”, “banana!boat”, and “banana boat”.
- Backslash (\) – There may be occasions that you want to specify an exact match on a string that contains wildcard characters. For example, you might want to specify a match on a subject line where the main heading is surrounded on both sides by three asterisks, such as “***FREE GIFT***”. To specify a wildcard as a character rather than a substitution for other characters, use the backslash immediately before the character. For example, the comparison string “\*\*\**\*\*\*” specifies a subject with three asterisks before and after any string in the middle.
The next step is to choose the action that should be performed if the conditions are met. You can specify multiple actions for a set of conditions. The actions are executed in the order of their appearance in the action box.
Actions can be one of the following options
- Keep in Inbox saves the email message to your inbox.
- Discard deletes the email message without delivering it and you won’t be able to see it in any folder not even in the trash.
- Move into Folder moves the email message to the specified folder. If the specified folder does not exist, the message is saved to the inbox.
- Tag with tags the email message with your specified tag.
- Mark as marks the email message as Read or Flagged.
- Redirect to Address sends the email message to your specified address.
In the case of defining multiple actions, you should pay attention to these points
- If Discard is combined with other actions, discard is ignored and the other actions take place.
- If multiple Move into Folder actions used, it creates multiple copies of the message stored in different folders. If a specified folder does not exist, the message is saved to the inbox.
- If Tag with or Mark as is combined with other actions, it is only applied to the email message returned from the nearest preceding action.