Add a disclaimer to a message with a carriage return..


(**Be warned - this is not an interesting blog...)

Nevertheless there might be someone out there that desperately needs to know how to add a carriage return to a disclaimer through powershell...?  I was that person up to about half an hour ago.  The following transport rule adds a disclaimer to all outbound emails except for all outbound emails that already have the disclaimer (based on a unique piece of text in the original disclaimer). So if you reply to a reply to a external recipient you do not end up with multiple disclaimers.

In addition the disclaimer has a carriage return within the text of the disclaimer. This is done by adding `r to the disclaimer text.

So here it is:

$Condition1 = Get-TransportRulePredicate FromScope
$Condition1.Scope = "InOrganization"
$Condition2 = Get-TransportRulePredicate SentToScope
$Condition2.Scope = "NotInOrganization"
$Exception1 = Get-TransportRulePredicate SubjectorBodyContains
$Exception1.Words = @("thisisadulldisclaimerisntit")
$Action = Get-TransportRuleAction ApplyDisclaimer
$Action.Text = "This is a disclaimer with the unique text thisisadulldisclaimerisntit and a carriage return here `r and another one right here `r and this is the last line of this disclaimer"
$Action.Font = "Arial"
$Action.FontSize = "smaller"
$Action.FontColor = "gray"
New-TransportRule -Name "Append a disclaimer to all outbound emails" -Condition @($Condition1, $Condition2) -Exception @($Exception) -Action @($Action)

Half an hour well spent you'll agree..!

Comments (3)
  1. It’s interesting. Did you found list of other special signs which can be included in disclaimer? I still looking for possibility to add sender name to disclaimer, just like in Antigen 9.0

  2. This article is where I found the information: about_Special_Characters at http://technet.microsoft.com/en-us/library/bb978542.aspx .. Doesn’t help with your query – sorry.  Not a powershell expert but it’ll be on Technet somewhere!  Sorry I can’t be of more help.

  3. randyw says:

    Use PowerShell’s command to obtain this as follows;  

    help about_special_characters

Comments are closed.

Skip to main content