Test-Message

Applies to: Exchange Server 2010

Use the Test-Message cmdlet to troubleshoot the impact of Inbox rules on a specific message. If a message is being handled in an unexpected manner, you can use this cmdlet to resubmit that message and gather detailed information about how rules are processing it.

Syntax

Test-Message -Recipients <ProxyAddressCollection> [-Confirm [<SwitchParameter>]] [-DeliverMessage <SwitchParameter>] [-MessageFileData <Byte[]>] [-Sender <SmtpAddress>] [-SendReportTo <RecipientIdParameter>] [-WhatIf [<SwitchParameter>]]

Parameters

Parameter Required Type Description

Recipients

Required

Microsoft.Exchange.Data.ProxyAddressCollection

The Recipients parameter specifies the list of e-mail addresses to be used as recipients for the test message if an .eml file isn't specified.

Confirm

Optional

System.Management.Automation.SwitchParameter

The Confirm switch causes the command to pause processing and requires you to acknowledge what the command will do before processing continues. You don't have to specify a value with the Confirm switch.

DeliverMessage

Optional

System.Management.Automation.SwitchParameter

The DeliverMessage switch specifies that the message should be delivered to its final destination. If you don't specify this switch, the message that's resubmitted isn't delivered to its recipients. Only troubleshooting data is generated and sent to the specified recipient.

MessageFileData

Optional

System.Byte[]

The MessageFileData parameter specifies file data retrieved from an .eml file using the Get-Content cmdlet.

For more information about the syntax required to use this parameter, see Understanding Importing and Exporting Files in the Exchange Management Shell.

Sender

Optional

Microsoft.Exchange.Data.SmtpAddress

The Sender parameter specifies the e-mail address to be used as the message sender for the test message if an .eml file isn't specified.

SendReportTo

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter

The SendReportTo parameter specifies the e-mail address to which the final report is sent.

WhatIf

Optional

System.Management.Automation.SwitchParameter

The WhatIf switch instructs the command to simulate the actions that it would take on the object. By using the WhatIf switch, you can view what changes would occur without having to apply any of those changes. You don't have to specify a value with the WhatIf switch.

Detailed Description

You need to be assigned permissions before you can run this cmdlet. Although all parameters for this cmdlet are listed in this topic, you may not have access to some parameters if they're not included in the permissions assigned to you. To see what permissions you need, see the "Testing transport rule processing" entry in the Transport Permissions topic.

Examples

EXAMPLE 1

This example resubmits a specific e-mail message and sends the final report to the postmaster@contoso.com e-mail address.

Test-Message -MessageFileData ([Byte[]]$(Get-Content -path c:\testmessage.eml" -encoding byte -ReadCount 0)) -SendReportTo postmaster@contoso.com