How message and attachment filters are applied

This section describes the order in which message and attachment evaluation is applied when filtering Exchange Server messages.

When custom filters processes messages, the following general points are observed:

Figure: Processing attachments shows how custom filtering processes a message with attachments.

Figure: Processing attachments

Processing attachments

The message illustrated has a nested message attached and that message has a file attached. The simple ruleset file has two rules that contain message filters and one rule that contains attachment filters, as follows:

Message filters and attachment filters can be combined in a single rule to select attachments to particular messages.

Figure: Example message with attachments shows an example message to the recipient, Karen Little, that has an MP3 file attached and also a message attached (a nested message).

Figure: Example message with attachments

Example message with attachments

The message may also have attachments.

The following example ruleset file contains a single rule to be applied to this message. The overall effect of this rule is to delete certain attachments in Exchange Server messages to recipients other than Gill Smith or John Doe. Attachments in messages to Gill Smith or John Doe are not deleted. Attachments with the following attributes will be deleted:

<?xml version="1.0" encoding="UTF-8"?>
<RULE_SET xmlns="x-schema:ruleset schema.xdr">

<!--Disallowed attachment rule: This rule will delete the specified
attachments for all recipients except Gill Smith and John Doe.-->

<RULE NAME="Disallowed attachments (except directors)"
   ATTACHMENT_ACTION="REMOVE" >
  <RECIPIENTS INCLUDES="NONE" ALLOWOTHERS="N">
	<EA>Gill.Smith@example.com</EA>
	<EA>John.Doe@example.com</EA>
  </RECIPIENTS>
  <FILES INCLUDES="ANY">
	<FILE FILENAME="*.MP3" SIZE_GREATER_THAN_KB="2000" />
	<FILE FILENAME="*.JPG" SIZE_GREATER_THAN_KB="1000" />
	<FILE FILENAME="*.MPG" SIZE_GREATER_THAN_KB="5000" />
  </FILES>
</RULE>

Assuming the appropriate archiving task has custom filtering enabled, the filters in this ruleset will be applied to the example message, as follows: