Creating Filters

Setting up filter rules (Back to Top)

Email filtering allows you to define rules to manage incoming email. Filtering applies a set of rules to incoming email and then executes a specified action.

You can filter your incoming email messages to:

  • Sort them into folders
  • Automatically tag them
  • Forward them
  • Discard them

For example, you could define a filter rule to identify mail coming from your immediate supervisor and move it to a folder called "From My Boss" or to automatically move messages from a specific address to the Trash folder.

Filter conditions

Each filter rule can contain several conditions. For example, if your supervisor sends you emails from more than one address, such as jane.smith@company.com or from jane-smith23@yahoo.com, you could create one filter called "Supervisor" which has two conditions, one for each email address.

Conditions include:

  • Specific addresses in the From:, To:, Cc: addresses in the email header
  • The presence or absence of file attachments
  • Words or character strings in the subject or body of the mail message

All the conditions allow you to specify "not" as a negative condition. For example, you can specify mail that does not contain a particular word.

You can combine conditions to search for mail with more complex characteristics.

Any versus. All

Conditions within a filter rule can be grouped using Any or All . The use of these terms is similar to the "AND" versus. "OR" type searches described under the Search feature, with Any being OR and All being AND.

If you choose Any when defining conditions for a new filter rule, then a message that meets any one of the conditions is considered a match. However, if you choose All, every condition specified in that filter rule must apply in order for that message to match the filter.

Filter rule actions

Each filter rule can specify one or more actions. Actions include:

  • Leave the message in the Inbox (no action).
  • Move the message to another specified folder.
  • Tag the message
  • Mark the message as read or as flagged.
  • Discard the message. This action drops the email message silently. It is not the same as the Delete action on your menu. Deleting an item moves it to the Trash folder. The Discard action prevents the message from ever reaching your mailbox.
  • Forward the message to another address.

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. If it is not specified, subsequent filter rules are evaluated for the mail message, even if the current filter is a match. You probably do not want to have the same message match more than one filter rule and undergo multiple, perhaps contradictory actions.

When filters are applied

Each incoming message is tested against your filter rules at the time that the mail is delivered and the filter actions are applied to matching messages at that time.

Filter Order

The filters are applied in the order they are listed on the Mail Filter tab. You can change that order.

Within each filter, the conditions are used to test each mail message. If the message meets the conditions collectively (using the Any or All designation as specified in the filter rule), it is considered a match. The order of the conditions within each filter is not important.

If the message matches the conditions, all actions associated with that filter rule are applied, in the order in which they appear in the filter.

Active versus. inactive filters

All filters currently defined are listed on the Options, Mail Filter page. The Active check box allows you to turn filters on or off without having to delete the filter rules. .

Filtering your messages (Back to Top)

Filtering applies a set of matching rules to incoming mail and then executes a specified action.

You can filter your incoming mail messages to sort them into folders, automatically tag them, forward them, or discard them. For example, you could create a rule as follows:

  • All mail from your supervisor goes in "Management Directives" folder.
  • All mail from the "corporate-events" mailing list is tagged with the "Events" tag.
To create or edit a new filtering rule:
  1. Click the Preferencestab.
  2. Open the Mail Filters tab and click New Filter.
  3. The Add Filter dialog displays.
  4. In Filter Name, type the name for the rule.
  5. In the If the following conditions are met area, choose a grouping preference.
  • Any conditions means that if any of the conditions in the filter are met, apply the action.
  • All conditions means that all of the conditions in the filter must be met in order to apply the filter action.

The following steps can be repeated to set up multiple conditions and actions within a single filter.

  • Select from the first drop-down list which condition to use.
  • Choose a comparison method. The options shown depend on your choice in the previous drop-down. For example, "is" or "is not" could be shown.
  • Enter a word or phrase to compare against in the text field.

Click , to add more conditions. You can continue to add more conditions or proceed to the next part, which is to add one or more actions.

  1. In the Perform the following actions area, choose an action from the drop-down list.
  • Specify a folder or tag name, if necessary. What you specify depends on the action you choose.

Click , to add more actions. You can continue to add more actions or click OK to finish.

  1. Check the Active box to turn on the filter rule.

The filter will be applied automatically to all new incoming mail messages as they arrive.

  • You can also create a new filter from an email message. Right-click on the message, choose New Filter. The Edit Filter dialog displays with From, To, and Subject set with this information from the email message. If the filter conditions are correct, give the filter a name and click OK.

Filter conditions and actions supported (Back to Top)

Filter rules are not case-sensitive, meaning that the rules ignore capitalization.

Conditions

Comparison fields include the following:

  • From. Use this to specify a name in the From: header of an email message.
  • To. Same as From, but looks for specified names in the To: header.
  • CC. Same as From, but looks in the Cc: header.
  • Subject. Looks in the message's Subject header.
  • Header Named. When this option is selected, an additional text input field appears before the comparison operator (the "contains" portion). This option allows you to specify any email header. You can specify not only the standard fields of To: or From: but also Date, Reply-To, or other custom fields that may be included in the message header. You could use this option to filter out email messages that have "malformed" headers, meaning they do not contain certain information that is normally considered standard for an email message. Sometimes spam, which is automatically generated, omits information such as the Sender or Reply-To fields. Use the second text field (the field immediately to the right of the comparison operator) to specify the header to test for.
  • Size. Use this to select email messages that are larger or smaller than a specified size. The size of the email includes any file attachments. You can use this to discard email messages that are too large.
  • Date. Use this option to specify email messages sent before or after a specified date.
  • Body. The options for Body are Contains/Does not contain, and this allows you to specify matching words in the body of the email. You cannot filter for words in file attachments.
  • Attachment. You can filter for email messages that have, or don't have, file attachments.
  • Address In. Tests for the presence of an address in your contacts. The next field allows you to specify which address.

Comparison operators include the following:

  • Matches exactly/does not match exactly. Specifies an exact match. For example, specifying Subject matches exactly Banana would only match "Banana" and not "Bananas" or "A truck full of banana leaves".
  • Contains/does not contain. Specifies that the subject line must contain the specified substring. For example, specifying Subject contains Banana would match "I'm going bananas".
  • Matches wildcard/does not match wildcard condition. The wildcard * is a character used in the mail filter comparison field to represent one or more characters in the filter . For example, specifying Subject matches "banana*" would match "bananas" or "banana-leaf casserole" but not "my banana-leaf casserole."

Actions

  • Keep in Inbox. Saves mail to Inbox. If none of the filter rules match an email message, this action takes place by default.
  • File into folder. Moves the mail to a specified folder.
  • Discard. Deletes the mail message without delivering it. The message is not in any of your folders, not even Trash.
  • Forward. Forwards mail to the address you specify
  • Mark. Select as Read or as Flagged.
  • Tag with. You can tag matching messages with a selected tag.
  • Do not process additional filters - When this is enabled, other filters are not checked.

Multiple Actions

You can create a filter rule made up of multiple actions. The combinations of actions in your rule are interpreted as follows:

  • Discard. If combined with other actions, discard is ignored and the other actions take place.
  • File into folder. Multiple "file into" actions results in multiple copies of the message being stored in different folders. If a specified folder does not exist, the message is saved to the Inbox.
  • Tag/Mark. These actions apply to the message returned from the nearest preceding action. In the case of multiple "File into" actions, this could result in some copies of the message stored without a tag, and others stored with a tag.
  • Keep in Inbox. Multiple "keep" actions can be specified, but only one copy of the message is saved to the Inbox.
  • Forward to address. Mail is forwarded to the address specified.

Filtering using contains, matches, and is options (Back to Top)

Three of the comparison methods for filter conditions are Contains, Matches pattern, and Matches Exactly. These options appear for some items such as the subject line.

  • 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 pattern means that the specified line 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 line must match "bananas" would only match "bananas" and not "Banana", "My bananas", or "Bananas?"

Filter wildcards (Back to Top)

Wildcards can be used in comparisons that use the "Matches pattern" comparison operator. The two wildcard characters are * and ?

Asterisk (*)

The asterisk * is a placeholder for "zero or more characters of any type".

Example subject-line search string: banana*float

With Matches: Subject lines such as "bananafloat", "bananas", "banana-leaf casserole float" but not "super-banana-float"

Example subject-line search string: w*bandanna

With Matches: Subject lines such as "white bandanna" or "whose bandanna" but not "whose bandanna is this?"

Question mark (?)

The question mark is a placeholder for "exactly one character".

Example subject-line search string: banana?boat

With Matches: Subject lines such as "bananasboat", "banana-boat", "banana!boat", or "banana boat"

Escape character is Slash: \

There may be times that you will want to specify an exact match on a string that contains characters that normally are considered wildcards. 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

***MORE MONEY!!!*** or

***FREE GIFT***

To specify a wildcard as itself 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 (including spaces).