Writing your own transport agent for Exchange Server 2010 is not complicated or an unsolvable task to do.
This transport agent example is the outcome of a requirement to modify email attachments with a GUID based filename. Those filenames were not really usable for the recipients. Interestingly, the email subject contained the information of the content of the attachments. The emails were automatically generated by a SAP reporting application.
TaskThe automatically generated email contains two attachments (two different file types just for the sake of demonstration). The email subject contains the report date in dd.MM.yyyy format.
The transport agent should perform the following actions:
Catch emails from a dedicated sender address which needs to be configurable without uninstalling/installing the transport agent
Check if the list of attachments contains files with a filename starting with “WORKBOOK_”
Check if the email subject is starting with a valid date string
Change the email subject to the format [yyyyMMdd] [ORGINAL SUBJECT WITHOUT DATE]
Modify the filenames of all attachments matching the filter requirement to the filename format [yyyyMMdd] [ORIGINAL SUBJECT WITHOUT DATE]-[COUNT].[ORGINAL FILE EXTENSION]
With the installed transport agent the modified email looks like this in the inbox of the recipient:
A dedicated development server with Exchange Server 2010 and Visual Studio 2010 should be used.
To force the email message to flow through the development server a new distribution group having the development server as the expansion server is created. This reduces the need to host the target mailbox on the server as well. Just go with the Hub server role.
When debugging the transport agent the following steps are required:
Install and register the debug build of the agent with Exchange Server 2010
Attach to the EdgeTransport.exe process
Send an email test message to the distribution group
Now mostly anything can be done (to) with the message.
The example page contains additional Powershell scripts for installing and removing the debug version on the development server and for the deployment of the release version on the production server.
Tracking Down Overactive Mailboxes with Get-StoreUsageStatistics