Transport Agent: Remove extra prefixes from email subject

If you regularly send email internationally, you may notice an issue that crops up in email conversations between two locales where the “Re.” prefix differs.  Basically, each time the message is replied to, another Re. (or Aw., Antwort, etc.) is tagged on to the beginning of the Subject.  This is more noticeable when an email goes between two different email systems, as Exchange does have some mechanisms that can prevent this happening.

The question was asked recently if there is an automated way to deal with this, and while I do not know of any built in Exchange functionality to remove excess prefixes, it is certainly possible to implement this feature in a transport agent.

Attached is full source for an Exchange 2007 transport agent that will remove excess prefixes (just leaving the left-most one).  It has some built in prefixes, but the list can be modified by setting a registry entry (if the registry entry is found, this replaces the default list).

To install the transport agent (assuming the EditMailSubjectSampleTransportAgent.dll file is in c:\TA on the Exchange server), run the following commands in an Exchange PowerShell console:

Install-TransportAgent -Name EditMailSubjectSampleTransportAgent -TransportAgentFactory EditMailSubjectSampleTransportAgent.EditMailSubjectSampleTransportAgentFactory -AssemblyPath c:\TA\EditMailSubjectSampleTransportAgent.dll

Enable-TransportAgent -Identity EditMailSubjectSampleTransportAgent

Restart-Service MSExchangeTransport

The registry value that the transport agent checks for a prefix list is found in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\EditMailSubjectTransportAgent, and is a multi-value string called PrefixList.  If no list is found, the default prefixes that are removed are re, antwort, wg, aw, weiterl.

Comments (0)