PowerShell command to bypass Office 365 spam filter

exchangeonlinemicrosoft-office-365powershell

I'm looking to create an Office 365 transport rule to allow inbound emails from selected IP addresses to bypass the spam filter.

Can someone please help?

The closest I've been able to come up with is:

Set-TransportRule -Name "Whitelist" -ExceptIfSenderIpRanges {1.1.1.1,2.2.2.2,3.3.3.3,4.4.4.4} -SetSCL -1

Thanks for your help!

Best Answer

CSV file:

enter image description here

Cmdlet:

$IPs = Import-Csv C:\root\IP.CSV
$IpRange =$IPs.IP
Get-TransportRule  <Rule Name> | Set-TransportRule -ExceptIfSenderIpRanges $IPRange
Get-TransportRule  <Rule Name>  |fl  ExceptIfSenderIpRanges

Figure as below: enter image description here

Related Topic