다음을 통해 공유


XHeader Sample Application

Topic Last Modified: 2007-06-18

This sample shows you how to respond to the OnEndOfHeaders event and read and modify X-headers in messages.

Structure of the Sample

The XHeader sample agent consists of a simple Microsoft Visual Studio .NET 2005 C# project. By default, the files are installed to C:\Program Files\Microsoft\Exchange Server 2007 SDK\Beta 2\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.

Executing the Sample

To execute the XHeader sample agent

  1. Open the XHeader sample agent project in Visual Studio .NET 2005.

  2. Attach the Visual Studio .NET 2005 debugger to the EdgeTransport.exe process.

  3. Telnet to port 25 of the computer that is running Microsoft Exchange Server 2007.

  4. 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.

  5. Telnet to port 25 of the Exchange server.

  6. 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.

Installing the Sample

To install the XHeader sample agent

  1. 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 2007 installation directory.

  2. Open the Exchange Management Shell and run the install.ps1 script.

  3. Exit the Exchange Management Shell.

Uninstalling the Sample

To uninstall the XHeader sample agent

  1. 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 2007 installation directory.

  2. Open the Exchange Management Shell and run the uninstall.ps1 script.