How to bulk add SPAM white and black list in Exchange Online Protection?


I hope you have a text files with SPAM white and black lists. If so, it’s all down to run the PowerShell command after connecting to Exchange Online.

If you created custom SPAM filter policy, replace “default” in Identity property with your custom filter policy name in the commands below.

Create different text files for Allowed and Blocked email addresses. Also create different text files for allowed and blocked email domain names.

The first line should be “Recipients” in all the text files.

Add bulk add SPAM White List (email addresses)

Import-Csv “C:\..\AllowedEmails.csv” | foreach {Set-HostedContentFilterPolicy -Identity Default -AllowedSenders @{add=$_.Recipients}} 

Add bulk add SPAM Block List (email addresses)

Import-Csv “C:\..\BlockedEmails.csv” | foreach {Set-HostedContentFilterPolicy -Identity Default –BlockedSenders @{add=$_.Recipients}} 

Add bulk add SPAM White List (email domains)

Import-Csv “C:\..\AllowedDomains.csv” | foreach {Set-HostedContentFilterPolicy -Identity Default –AllowedSenderDomains @{add=$_.Recipients}} 

Add bulk add SPAM Block List (email addresses)

Import-Csv “C:\..\BlockedEmails.csv” | foreach {Set-HostedContentFilterPolicy -Identity Default –BlockedSenderDomains @{add=$_.Recipients}} 

I hope it saved you sometime on your research.  Leave me a reply if it did.

Advertisements

3 thoughts on “How to bulk add SPAM white and black list in Exchange Online Protection?

  1. Definitely save me time! Just might have to “Enable-OrganizationCustomization” before you run. But it will say so if you need to do it.

  2. Skype has opened its web-structured client beta to the entire world, soon after introducing it broadly from the
    U.S. and U.K. earlier this calendar month.

    Skype for Website also now works with Chromebook and Linux
    for instant messaging conversation (no video and voice yet, these call for a connect-in installation).

    The increase from the beta provides help for a longer set of languages to
    help you bolster that international usability

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s