Partager via


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

  • Anonymous
    April 10, 2008
    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

  • Anonymous
    April 10, 2008
    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.

  • Anonymous
    July 03, 2008
    Use PowerShell's command to obtain this as follows;   help about_special_characters