Applies to: Exchange Server 2013, Exchange Online Protection, Exchange Online

Topic Last Modified: 2013-02-22

Using Transport rules you can look for specific conditions on messages that pass through your organization and take action on them. This topic shows you how to perform basic configuration tasks related to managing Transport rules in Exchange 2013.

Caution:
Before you create or modify transport rules in your production environment, we recommend that you use a test environment to understand the effects of the rule, or use the rule in test mode. Test all rules before creating them in a production environment.

To learn more about Transport rules, see Transport Rules.

What do you need to know before you begin?

Tip:
Having problems? Ask for help in the Exchange forums. Visit the forums at: Exchange Server, Exchange Online, or Exchange Online Protection

What do you want to do?

Create a Transport rule

Use the EAC to create a Transport rule

By default, the EAC allows you to create simple transport rules quickly. These rules consist of a single condition and a single action without any exceptions.

  1. Navigate to mail flow > rules.

  2. Click Add Add Icon to display a list of available templates. You can select a template that fits your need, or select Create a new rule to create a rule from scratch. The remainder of this procedure assumes that you are creating a rule from scratch.

  3. In new rule, give a name to the rule and then select the condition and action for this rule:

    1. Select the condition you want from the list of available conditions listed in the *Apply this rule if… dropdown. Some of the conditions will require you to specify values. For example, if you select The sender is… predicate, you will need to specify a sender address.

      If you don't want to specify a condition, and want this rule to apply to every message in your organization, select [Apply to all messages] condition.

    2. Select the action you want the rule to take on messages matching the criteria from the list of available actions listed in the *Do the following… dropdown. Some of the actions will require you to specify values. For example, if you select the Forward the message for approval to… predicate, you will need to select a recipient in your organization.

    3. For transport rules that are related to data loss prevention (DLP) policies, you can specify an audit severity level. When a user takes an action that isn't in-line with a DLP policy, the rule will assign the specified audit severity level when it's triggered. Click Use the Audit this rule with severity level check box to specify an audit severity level for this rule.

    4. In Exchange 2013, you can create a Transport rule in test mode. This enables you to test new rules without impacting mail flow. Click one of the following:

      • Enforce   This will turn on the rule and it will start processing messages immediately.

      • Test with Policy Tips   This will turn on the rule, and what would have happened if the rule was enforced is logged in message tracking logs. Exchange doesn’t take any action that will impact the delivery of the message. In addition, senders are notified of the actions the rule will take if the rule contains the Notify the sender with a Policy Tip action.

      • Test without Policy Tips   This will turn on the rule, and what would have happened if the rule was enforced is logged in message tracking logs. Exchange doesn’t take any action that will impact the delivery of the message.

  4. If you are satisfied with the rule, go to step 5. If you want to add more conditions or actions, or if you want to specify certain exceptions, click More options. This will enable all the transport rule properties. After you click More options, complete the following fields to create your rule:

    1. To add more conditions, click add condition. If you have more than one condition, you can remove any one of them by clicking Remove X next to it. Note that there are a larger variety of conditions available once you click More options.

    2. To add more actions, click add action. If you have more than one action, you can remove any one of them by clicking Remove X next to it. Note that there are a larger variety of actions available once you click More options.

    3. To specify exceptions, click add exception, then select exceptions using the Except if... dropdown. You can remove any exceptions from the rule by clicking the Remove X next to it.

    4. If you want this rule to take effect after a certain date, click Activate this rule on the following date: and specify a date. Note that the rule will still be enabled prior to that date, but it won't be processed.

    5. Similarly, you can have the rule stop processing at a certain date. To do so, click Deactivate this rule on the following date: and specify a date. Note that the rule will remain enabled, but it won't be processed.

    6. You can choose to avoid applying additional rules once this rule processes a message. To do so, click Stop processing more rules. If you select this, and a message is processed by this rule, no subsequent rules are processed for that message.

    7. You can specify how the message should be handled if the rule processing can't be completed. By default, the rule will be ignored and the message will be processed regularly, but you can choose to resubmit the message for processing. To do so, check the Defer the message if rule processing doesn't complete check box.

    8. If your rule analyzes the sender address, it only examines the message headers by default. However, you can configure your rule to also examine the SMTP message envelope. To specify what's examined, click one of the following values for Match sender address in message:

      • Header   Only the message headers will be examined.

      • Envelope   Only the SMTP message envelope will be examined.

      • Header or envelope   Both the message headers and SMTP message envelope will be examined.

    9. You can add administrative comments to this rule that gives more information about the rule in the Comments box.

  5. Click save to complete creating the rule.

Use the Shell to create a Transport rule

This example creates a new transport rule that prepends "External message to Sales DG:" to messages sent from outside the organization to the Sales Department distribution group.

Copy Code
New-TransportRule -Name "Mark messages from the Internet to Sales DG" -FromScope NotInOrganization -SentTo "Sales Department" -PrependSubject "External message to Sales DG:"

The rule parameters and action used in the above procedure are for illustration only. Review all the available transport rule predicates and actions to determine which ones meet your requirements.

How do you know this worked?

To verify that you have successfully created a new Transport rule, do the following:

  • From the EAC, verify that the new Transport rule you created is listed in the rules list.

  • From the Shell, verify that you created the new Transport rule successfully by running the following command (the example below verifies the rule created in the Shell example above):

    Copy Code
    Get-TransportRule "Mark messages from the Internet to Sales DG"
    

View or modify a Transport rule

Use the EAC to view or modify a Transport rule

  1. From the Exchange admin center, navigate to mail flow.

  2. Select rules. This will display a list of all rules defined in your organization in the order they are applied.

  3. When you select a rule in the list, the conditions, actions, exceptions and select properties of that rule are displayed in the details pane. To view all the properties of a specific rule, double click on it. This will open the rule editor window, which will allow you make changes to the rule. For more information about using the Transport rule dialog, see Use the EAC to create a new Transport rule section, earlier in this topic.

Use the Shell to view or modify a Transport rule

The following example gives you a list of all rules configured in your organization:

Copy Code
Get-TransportRule

To view the properties of a specific Transport rule, you need to provide the name of that rule or its GUID. It is usually helpful to pipeline the output to the Format-List cmdlet to view all details available. The following example will return all the properties of the Transport rule named Sender is a member of Marketing:

Copy Code
Get-TransportRule "Sender is a member of marketing" | Format-List

If you want to modify the properties of a specific rule, you need to use the Set-TransportRule cmdlet. This cmdlet allows you to change any property, condition, action or exception associated with a rule. The following example adds an exception to the rule "Sender is a member of marketing" so that it won't apply to messages sent by the user Kelly Rollin:

Copy Code
Set-TransportRule "Sender is a member of marketing" -ExceptIfFrom "Kelly Rollin"

How do you know this worked?

To verify that you have successfully modified a Transport rule, do the following:

  • From the EAC, click on the rule you modified in the rules list and view the details pane.

  • From the Shell, verify that you modified the Transport rule successfully by running the following command that will list the properties you modified along with the name of the rule (the example below verifies the rule modified in the Shell example above):

    Copy Code
    Get-TransportRule "Sender is a member of marketing" | Format-List Name,ExceptIfFrom
    

Enable or disable a Transport rule

To temporarily stop the Transport rules agent from executing a transport rule, you can disable the rule.

Use the EAC to enable or disable a Transport rule

  1. From the Exchange admin center, navigate to mail flow.

  2. Select rules. This will display a list of all rules defined in your organization in the order they are applied.

  3. To disable a rule, clear the checkbox next to its name.

  4. To enable a rule, click the checkbox next to its name.

Use the Shell to enable or disable a Transport rule

The following example disables the Transport rule "Sender is a member of marketing":

Copy Code
Disable-TransportRule "Sender is a member of marketing"

The following example enables the Transport rule "Sender is a member of marketing":

Copy Code
Enable-TransportRule "Sender is a member of marketing"

How do you know this worked?

To verify that you have successfully enabled or disabled a Transport rule, do the following:

  • From the EAC, view the list of rules in the rules list and check the status of the checkbox in the ON column.

  • From the Shell, run the following command which will return a list of all rules in your organization along with their status:

    Copy Code
    Get-TransportRule | Format-Table Name,State
    

Remove a Transport rule

Use the EAC to remove a Transport rule

  1. From the Exchange admin center, navigate to mail flow.

  2. Select rules. This will display a list of all rules defined in your organization in the order they are applied.

  3. Select the rule you want to remove and then click Delete Delete Icon.

Use the Shell to remove a Transport rule

The following example removes the Transport rule "Sender is a member of marketing":

Copy Code
Remove-TransportRule "Sender is a member of marketing"

How do you know this worked?

To verify that you have successfully removed the Transport rule, do the following:

  • From the EAC, view the rules in the rules list and verify that the rule you removed is no longer shown.

  • From the Shell, run the following command and verify that the rule you remove is no longer listed:

    Copy Code
    Get-TransportRule
    

For More Information

Resources for Exchange Online:

Transport Rules

Transport Rule Predicates

Transport Rule Actions

Resources for Exchange Online Protection:

Transport Rules

Transport Rule Predicates

Transport Rule Actions

Resources for Exchange Server 2013:

Transport Rules

Transport Rule Predicates

Transport Rule Actions

New-TransportRule

Get-TransportRule

Set-TransportRule

Enable-TransportRule

Disable-TransportRule

Remove-TransportRule