Public/Spamfilter/Set-SpamfilterDomainDestination.ps1
function Set-SpamfilterDomainDestination { Param( [Parameter(Mandatory)] [string]$DomainName, [Parameter(Mandatory)] [string]$Destination ) process { try { $Credential = Get-SpamFilterCredential } catch { throw "Failed to retreive Spamfilter credential: $_" } try { $DomainName = [System.Web.HttpUtility]::UrlEncode($DomainName) $Destination = [System.Web.HttpUtility]::UrlEncode($Destination) $CompleteURI = "$($SpamfilterAPIBaseURL)/domain/edit/domain/$($DomainName)/destinations/[" + '"' + $Destination + '"]' $Response = (Invoke-WebRequest -Credential $Credential -Uri $CompleteURI).Content } catch { throw "Failed to set spamfilter domain destinations: $_" } $Response } } |