XHeader Sample Application
The XHeader sample shows you how to respond to the OnEndOfHeaders event and read and modify X-headers in messages.
To download this sample, download the Exchange 2010 Transport Agents SDK from the Microsoft Download Center.
The XHeader sample agent consists of a simple Visual Studio .NET 2005 C# project. By default, the files are installed to C:\Program Files\Microsoft\Exchange Server 2010 SDK\Samples\XHeader.
The following are the primary files for the sample:
-
Install.ps1 An Exchange Management Shell script that installs the compiled sample.
-
Uninstall.ps1 An Exchange Management Shell script that uninstalls the compiled sample.
-
XHeader.csproj The Visual Studio C# project file.
-
XHeaderAgent.cs The C# source code for the sample.
-
XHeaderConfiguration.cs The C# source code for the sample.
-
Remove.smtp A text file that contains Simple Mail Transfer Protocol (SMTP) protocol commands and test message content.
-
Reject.smtp A text file that contains Simple Mail Transfer Protocol (SMTP) protocol commands and test message content.
To execute the XHeader sample agent
-
Open the XHeader sample agent project in Visual Studio .NET 2005.
-
Attach the Visual Studio .NET 2005 debugger to the EdgeTransport.exe process.
-
Telnet to port 25 of the computer that is running Exchange Server 2010.
-
Copy the contents from the Reject.smtp file and paste them into the telnet session. The server should reject the message and disconnect the telnet session.
-
Telnet to port 25 of the Exchange server.
-
Copy the contents from the Remove.smtp file and paste them into the telnet session. The server should accept the message and remove from the message the X-RemoveMe header.
To install the XHeader sample agent
-
Edit the install.ps1 script to make sure that the $EXDIR variable is initialized correctly for your system. The value of the $EXDIR variable should be the path of the Exchange Server 2010 installation directory.
-
Open the Exchange Management Shell and run the install.ps1 script.
-
Exit the Exchange Management Shell.
To uninstall the XHeader sample agent
-
Edit the uninstall.ps1 script to make sure that the $EXDIR variable is initialized correctly for your system. The value of the $EXDIR variable should be the path of the Exchange Server 2010 installation directory.
-
Open the Exchange Management Shell and run the uninstall.ps1 script.