Exchange Server 2007: Sample transport agent, add the name of the group to subject line

If you use rules to automatically sort messages from various distribution lists into folders in order to keep the volume of email traffic in their inbox to a manageable level. This work for the most part - until someone decides to BCC a list. Since the distribution list isn't visible in the list of recipients, it […]

If you use rules to automatically sort messages from various distribution lists into folders in order to keep the volume of email traffic in their inbox to a manageable level. This work for the most part - until someone decides to BCC a list. Since the distribution list isn't visible in the list of recipients, it bypasses all rules and gets dropped in their inbox. This can cause quite a distraction for everyone on that DL because something appeared in their inbox, and it's not quite apparent why they received that message.

Mailman and Majordomo have had this problem solved for a while now. It's actually a very simple solution: make sure the name of the mailing list is included in the subject of the email. Then users can set up filters based on words in the subject and they never encounter the problem when someone BCC's the list.

Exchange 2007 can do the same thing; it just needs a little help from a custom transport agent. I have written a very basic agent to add the name of the DL into the subject. You can use it as a starting point and add your own features.

To install this agent, follow these instructions:

  1. Copy ShowDLInSubjectAgent.dll to your transport server. In this example, I place it in C:\MyAgents
  2. Open the Exchange Management Shell
  3. Type Install-TransportAgent -Name ShowDLInSubjectAgent -TransportAgentFactory ShowDLInSubjectAgent.ShowDLInSubjectFactory -AssemblyPath C:\MyAgents\ShowDLInSubjectAgent.dll
  4. Close and restart the Exchange Management Shell.
  5. Type Enable-TransportAgent -Identity ShowDLInSubjectAgent
  6. Restart the transport service by typing Restart-Service MSExchangeTransport

If all goes well, all emails to a distribution list will now include the name of the DL in the subject of the email.

Full Article