Export (0) Print
Expand All

How to Configure a New Transport Rule for Messages That Have a Blank Subject

 

Applies to: Exchange Server 2007 SP3, Exchange Server 2007 SP2, Exchange Server 2007 SP1, Exchange Server 2007

Topic Last Modified: 2007-04-13

This topic explains how to use the Exchange Management Console or the Exchange Management Shell to configure a transport rule to perform an action on an e-mail message that has a blank subject line. This procedure can be used on computers that have the Hub Transport server role or the Edge Transport server role installed.

To create a new transport rule to perform an action on an e-mail message that has a blank subject line, you use the same procedure that you use to create a new transport rule. Transport rule actions are available on Hub Transport servers and Edge Transport servers. You use these actions modify the delivery or contents of messages that meet the conditions you specify.

For more information about transport rules, see Overview of Transport Rules.

To perform the following procedures, the account you use must be delegated the following:

  • Exchange Organization Administrator role

To perform the following procedures on a computer that has the Edge Transport server role installed, you must log on by using an account that is a member of the local Administrators group on that computer.

For more information about permissions, delegating roles, and the rights that are required to administer Microsoft Exchange Server 2007, see Permission Considerations.

CautionCaution:
This topic describes how to create new transport rules. Before you configure new transport rules in your production environment, use a test environment to learn how to create new transport rules and test them thoroughly. The following procedures are not intended to be run in a production environment without modification to support your organization.
importantImportant:
For transport rules to be applied to e-mail messages, a route must exist that enables the message to enter and leave a server that applies transport rules. Also, the message must not be subject to an administrator-configured transport restriction that prevents delivery of the message. If a transport restriction prevents delivery of a message, the Transport Rules agent cannot act on that message, and no Transport Rules agent events are logged.

To detect messages that have blank subject lines, the following procedures use the ^$ regular expression. This regular expression consists of two pattern strings, ^ and $. Pattern strings are used in regular expressions to match patterns in the text of a message when that text changes dynamically. When the ^ and $ pattern strings are used in this order, the transport rule condition matches only the exact string that is between the two pattern strings. Because there is no string between the ^ and $ pattern strings in the ^$ regular expression, this regular expression matches only an empty string, such as a blank subject line.

For more information about regular expressions, see Regular Expressions in Transport Rules.

The following procedures show you how to open the Transport Rule wizard on a Hub Transport server or an Edge Transport server in the Exchange Management Console, and then create a new transport rule to perform an action on an e-mail message that has a blank subject line. After you open the Transport Rule wizard, the procedure is the same on the Hub Transport server and the Edge Transport server.

  1. Open the Exchange Management Console on the Hub Transport server.

  2. In the console tree, click Organization Configuration, and then click Hub Transport.

  3. In the result pane, click the Transport Rules tab, and then in the action pane, click New Transport Rule… .

  1. Open the Exchange Management Console on the Edge Transport server on which you want to create the new transport rule.

  2. In the console tree, click Edge Transport.

  3. In the result pane, click the Transport Rules tab, and then in the action pane, click New Transport Rule… .

  1. In the Name field of the Transport Rule wizard, type the name of the transport rule.

  2. If you have notes for this rule, in the Comments field, type the notes.

  3. If you want the rule to be created in a disabled state, clear the Enabled check box. Otherwise, leave the Enabled check box selected.

  4. Click Next.

  5. In the Step 1. Select Condition(s) box, select the when the Subject field contains text patterns condition.

  6. In the Step 2. Edit the rule description (click an underlined value) box, click the text patterns blue underlined words.

  7. When you click the text patterns blue underlined words, a new window opens to prompt you for the values to apply to the condition. Type ^$ and then click Add. Click OK to close the window and then click Next.

  8. In the Step 1. Select Action(s) box, select all the actions that you want to be applied to this rule.

  9. In the Step 2. Edit the rule description (click an underlined value) box, click each blue underlined word.

  10. In the new window that appears, select the items that you want to apply, or type the values manually, and then click OK to close the window.

  11. Repeat the previous step for each action that you selected. After you configure all the actions, click Next.

  12. In the Step 1. Select Exception(s) box, select all the exceptions that you want to be applied to this rule. You are not required to select any exceptions.

  13. If you selected exceptions in the previous step, in the Step 2. Edit the rule description (click an underlined value) box, click each blue underlined word.

  14. When you click a blue underlined word, a new window opens to prompt you to select the items that you want to add, or to type the values manually. When you have finished, click OK to close the window.

  15. Repeat the previous step for each exception that you selected. After you configure all the exceptions, click Next.

  16. Review the Configuration Summary. If you are happy with the configuration of the new rule, click New, and then click Finish.

To use the Exchange Management Shell to create a new transport rule that applies a transport rule action to messages that have a blank subject line, see the "Using the Exchange Management Shell to Create a Transport Rule" section in How to Create a New Transport Rule.

The following procedure shows how you can add a transport rule condition to detect messages that have a blank subject line and apply an action to those messages.

  • Run the following commands:

    $Condition = Get-TransportRulePredicate SubjectMatches
    $Condition.Patterns = @("^$")
    

After you have added the blank subject line condition, add the transport rule action that you want to perform on messages that match the condition. For example, you may want to reject the message and send a customized non-delivery report (NDR). In this topic, the RejectMessage transport rule action is used to reject a message with an NDR. The RejectMessage transport rule action exists on the Hub Transport server role.

  • Run the following command:

    $Action = Get-TransportRuleAction RejectMessage
    

You can modify the text that is displayed to the sender in the Diagnostic information for administrators section of the NDR. This text can provide helpful information to enable the administrator to understand why the message was rejected.

You can also modify the delivery status notification (DSN) code and message that appears in the user information section of the NDR by specifying a customized DSN code. A customized DSN code is associated with a customized DSN message. It is useful to specify this code so that you can refer the user to an HTML link to a specific policy or regulation. By default, the NDR associated with the 5.7.1 DSN code is sent.

For example, if you create a new transport rule for messages that have a blank subject line and want to refer users to the Information Technology department if their message is rejected, you can specify a new, unused, customized DSN code in the EnhancedStatusCode property. After you specify a new customized DSN code, you must use the New-SystemMessage cmdlet to create the DSN code and specify the text that should be displayed when that DSN code is referenced. For an example of how to do this, see the "Configuring a Transport Rule that Rejects Messages that Have a Blank Subject" section later in this topic.

noteNote:
The RejectReason transport rule action is available only on Hub Transport servers. If you want to reject messages that have a blank subject line on Edge Transport servers, you must use the SmtpRejectMessage transport rule action. You can only specify the DSN code when you use the SmtpRejectMessage transport rule action. You cannot specify an alternative message to display to the user or administrator.
For more information about the SmtpRejectMessage transport rule action, see the "Supported Actions on an Edge Transport Server" section in Transport Rule Actions.

For more information about what values are accepted and how Exchange 2007 associates a DSN code with a transport rule, see Associating a DSN Message with a Transport Rule.

For more information about these action properties, see Transport Rule Actions.

After you configure the conditions, exceptions, and actions, create the new transport rule that enforces the transport rule.

  • Run the following command:

    New-TransportRule -Name "Sample Blank Subject Transport Rule" -Condition @($Condition) -Action @($Action)
    

The following example shows how you can apply a transport rule that rejects messages that have a blank subject on a Hub Transport server.

noteNote:
This transport rule uses a customized DSN code and message. The New-SystemMessage command in this example creates the customized DSN code and message. For more information, see Associating a DSN Message with a Transport Rule.

  • Run the following commands:

    $Condition = Get-TransportRulePredicate SubjectMatches
    $Condition.Patterns = @("^$")
    $Action = Get-TransportRuleAction RejectMessage
    $Action.RejectReason = "Messages must have a subject in the subject line or they are rejected."
    $Action.EnhancedStatusCode = "5.7.228"
    New-SystemMessage -DsnCode 5.7.228 -Internal $True -Language En -Text "This message was rejected because it did not have a subject in the subject line. For more information, please contact the Information Technology department."
    New-TransportRule "Blank Subject Transport Rule" -Condition @($Condition) -Action @($Action)
    
 
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft