This project is read-only.

What is it?

HeaderFilterAgent is a transport agent for Exchange 2007. The agent strips all X- headers from incoming internet email, except those headers listed in the whitelist in the registry. The point is to protect your Exchange servers from having their named props tables bloat due to random X- headers on incoming internet email.


An official fix for this problem was released for Exchange 2007 as part of Sp1 RU8. Once you've applied Sp1 RU8, HeaderFilterAgent should no longer be necessary. The fix changes the behavior so that X- headers are no longer promoted to named properties. This makes it unnecessary to remove the X- headers from the message.

How exactly does it work?

When the agent starts, it reads the whitelist from the registry key HKLM\Software\HeaderFilterAgent\Whitelist. If there is no such registry entry, or if the registry value does not contain any header names, the agent will do nothing at all. Assuming there's a whitelist, as each email comes in, the agent checks to see if the submission was authenticated or not. If it was not authenticated, the agent looks at each header starting with "X-" and compares it to each header in the whitelist. If the X- header is not found in the whitelist, it is removed. Comparisons are case-insensitive.

How do I install it?

To install the agent:

1. Download the DLL. Optionally, download the REG file.
2. Place the DLL in a folder somewhere on the Exchange 2007 server, such as C:\MyAgents.
3. Either import the included REG file by double-clicking it, or go into regedit and manually create the "HKLM\Software\HeaderFilterAgent" key. Under that key create a new Multi-String Value called "Whitelist", and add any headers you want to allow, each on a line by itself. You MUST add at least one header in order for the agent to activate. Enter each name on a line by itself with no quotes and no colon after it, such as:


The names are not case-sensitive. The included REG file automatically adds every header that is used internally by Exchange. You can use the REG file as is, or you can manually edit the list after importing it, or you can ignore it entirely and manually configure the whitelist.

3. In the Exchange command shell run:

Install-TransportAgent -Name "HeaderFilterAgent" -TransportAgentFactory "HeaderFilterAgent.HeaderFilterAgentFactory" -AssemblyPath "C:\MyAgents\HeaderFilter.dll"

4. Exit the Exchange command shell and launch it again, then run:

Enable-TransportAgent HeaderFilterAgent

5. Restart-service MSExchangeTransport

After restarting MSExchangeTransport, the agent should be active. If you update the whitelist, you must restart MSExchangeTransport for the new whitelist to take effect.

For more information on creating and installing your own transport agents, see this blog post:

Last edited May 26, 2009 at 4:29 PM by bilong, version 13