Transport Agent – Introduction
Exchange Server 2007 provides a class library based on the MS.NET Framework that enables you to implement transport agents that programmatically check and take action on transport events. It can be used to change and read the message contents during these events.
Transport agents enable you to access information about messages that travel through the Edge and Hub Transport servers. They have access to e-mail messages and their contents while the messages move through the transport services.
- An Exchange Server 2007 has Edge and Hub Transport server roles installed
- Microsoft.Net 2.0 SDK installed
- Microsoft Visual Studio .Net 2005 (recommended)
- Microsoft.Exchange.Data.Transport.Email – to make use of common email elements
- Microsoft.Exchange.Data.Transport.Smtp – to make use of SMTP receive agent
- Microsoft.Exchange.Data.Transport.Routing – to make use of Routing agent
When we install Exchange Server 2007 in our system, Exchange Sever installer installs & registers in the global assembly cache (GAC) the assemblies that are required for the development of transport agents.
To begin implementing a transport agent, create a reference to the Microsoft.Exchange.Data.Transport assembly in a class library project
- Download “Message Statistics Sample Agent” (reqd. C#.Net and an Edge Transport server)
- Download “Transport Agent Implementation Sample” (both in C#.Net & VB.Net)
Installing an Agent
Once you compile the agent to a .dll; you must install and enable the agent on development Exchange server. At Exchange Management Shell(EMS), use the Install-TransportAgent command to install your agent, and the Enable-TransportAgent command to enable your agent.
For example you can make use of EMS to install and enable an agent named “MyAgeOne” by using a class derived from SmtpReceiveAgentFactory named MyAgentOne.MyAgeOneFactory.
Install-TransportAgent -Name “MyCustomAgent” -TransportAgentFactory “MyAgeOne.MyAgeOneFactory” -AssemblyPath “C:\myagents\MyAgeOne.dll”
Enabling an Agent
For example the agent MyCustomAgent on the server on which the agent is installed:
Enable-TransportAgent -Name “MyCustomAgent”