Skip to content

Instantly share code, notes, and snippets.

@adamalbers
Last active March 7, 2022 15:17
Show Gist options
  • Save adamalbers/9e889e94e808f4bc5267d5c1bfea06b3 to your computer and use it in GitHub Desktop.
Save adamalbers/9e889e94e808f4bc5267d5c1bfea06b3 to your computer and use it in GitHub Desktop.
# Quarantines any emails using $blockedCharsets
# Supported charsets: https://docs.microsoft.com/en-us/exchange/mail-flow-best-practices/remote-domains/supported-character-sets
$allowedCharsets = @('UTF-8','US-ASCII','ISO-8859-1','WINDOWS-1252')
$blockedCharsetWords = @('big5','euc','gb','iso','koi','ks','ns','sen','shift','windows')
New-TransportRule -Name "Block Abnormal Charsets" -ContentCharacterSetContainsWords $blockedCharsetWords -ExceptIfContentCharacterSetContainsWords $allowedCharsets -Quarantine $true -Priority 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment