Cry Exchange 2010 How To...

How to add sender exceptions to content filtering (whitelisting senders)



We had a situation where a company was sending us emails and they were bouncing with:

550 5.7.1. Message rejected as spam by Content Filtering

we needed to receive these messages and the sending company was unable (or unwilling) to invest the time to identify why the messages were being blocked. In this instance it wasn't viable to whitelist their sending email server, so the approach I wanted was to whitelist the sender's email address.

Exchange Management Console does not allow you to do this. The only options it provides (Exchange Management Console → Microsoft Exchange On-Premises → Organizational Configuration → Hub Transport → Anti-Spam → Content Filtering) is to allow through emails containing certain words or phrases. This was a little too vague for me.

Whitelisting a single sender

Fortunately you can whitelist a sender - but you can only do this using the Exchange Management Shell.

The cmdlet to do this is:

Set-ContentFilterConfig -BypassedSenders email-address

so to whiltelist the email address "" would be:

Set-ContentFilterConfig -BypassedSenders

for example:

[PS] C\>Set-ContentFilterConfig -BypassedSenders

[PS] C:\>

Any emails that claim to come from that sender will now bypass content filtering. So be sure that it isn't an email address that spammers are likely to use!

That's it ... except not quite. In practice don't do this - why? see "Gotcha when whitelisting senders" below.

Listing whitelisted senders

To see which email addresses you have whitelisted in this way use:


for example:

[PS] C:\>(Get-ContentFilterConfig).BypassedSenders

Creating a new session for implicit remoting of "Get-ContentFilteringConfig" command...


   Length Local     Domain       IsValidAddress

   ------ -----     ------       --------------

       19 noreply            True


[PS] C:\>

Gotchas when whitelisting senders

Something to be aware of when using "Set-ContentFilterConfig -BypassedSenders" is that each time you use it you are overwriting the previous list. So:

[PS] C\>Set-ContentFilterConfig -BypassedSenders

[PS] C\>Set-ContentFilterConfig -BypassedSenders

[PS] C:\>

Will only whitelist "" and not ""!

To whitelist multiple email addresses you have to list each one on the same line, separated by a comma for example:

[PS] C\>Set-ContentFilterConfig -BypassedSenders,

[PS] C:\>

The other thing to be aware of is that (whilst it might seem obvious) remember that this works on the "sender" email, which might not be the same as the "from" email address. So if an email is sent "From on behalf of" then the sender is "" and the from address is "", so whitelisting would require the "" email address to be listed.

Adding a sender to the whitelist

If you have a list of senders to maintain then listing then all each time you call Set-ContentFilterConfig may not be convenient. But what you can do is to extract a list, add to that list and then use that to reset the list of whitelisted emails. Thus:

$whitelist = (Get-ContentFilterConfig).BypassedSenders
Set-ContentFilterConfig -BypassedSenders $whitelist

For example:

[PS] C:>$whitelist=(Get-ContentFilterConfig).BypassedSenders

[PS] C:>$whitelist.add("noreply@example")

[PS] C:>Set-ContentFilterConfig -BypassedSenders $whitelist

Whitelisting sender domains

You can also whitelist entire email domains:

Set-ContentFilterConfig -BypassedSenderDomains ""

although again the better way to do this would be:

$whitelist = (Get-ContentFilterConfig).BypassedSenderDomains


Set-ContentFilterConfig -BypassedSenderDomains $whitelist

and you can see the whitelisted domains using:


These notes have been tested with Exchange Server 2010.

About the author: is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.