Back to Blog

Creating an Exchange 2010 Transport Agent

Image of Thomas Stensitzki
Thomas Stensitzki
Solutions Engine blog

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.


Task
The 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:

 

Solution

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.

Enjoy!

 

 


Building your Own Exchange Test lab listing image

Build Your Own Exchange 2016 Test Lab

Image of AmyKelly Petruzzella
AmyKelly Petruzzella

The best way to learn about any technology, and specifically Exchange Server, is to be as hands-on...

Read more
Microsoft Icon

Scripting Agent Cmdlet Extension

Tracy Lwi

Exchange 2010 recently introduced a new feature called "cmdlet extension agents." These agents can...

Read more