Skip to main content

Manage Transport Rules

Problem

You want to manage transport rules applied to incoming or outgoing mail.

Solution

To create transport rules on the server, use the NewTransportRule cmdlet, as shown in Example 251.

Example 251. Creating a new transport rule

$from = GetTransportRulePredicate FromScope $from.Scope = "NotInOrganization"

$attachmentSize = GetTransportRulePredicate AttachmentSizeOver $attachmentSize.Size = 0

$action = GetTransportRuleAction ApplyDisclaimer $action.Text = "Warning: Only open attachments you were already expecting."

NewTransportRule Name "Attachment Warning" ` Conditions $from,$attachmentSize Action $action Enabled:$true

Discussion

The NewTransportRule cmdlet adds transport rules on the server. A transport rule is a collection of predicates and actions—conditions and actions that apply to the rule.

In the example given by the solution, we add a rule that warns internal users about the dangers of unexpected attachments received from the outside world. For more information about the NewTransportRule cmdlet, type GetHelp NewTransportRule. 

If you need dedicated infrastructure for business email workloads, consider a Dedicated Server Singapore for greater control over mail-server configuration, transport rules, email policies, and server resources.

Help Category