Platform SDK: Exchange Server

PROXYGEN: Generating a Proxy Address

PROXYGEN is a DLL that generates a proxy address of type EDK for the sample gateway. It creates the address from a combination of site and recipient attributes as determined by the site level proxy.

PROXYGEN demonstrates the use of the following functions:

RcInitProxies

RcGenerateProxy

RcValidateProxy

FreeProxy

To use it, you must first install the EDK address type by running the sample gateway setup program.

When the gateway is first installed, or when you modify an existing proxy address, Microsoft Exchange Server automatically calls the proxy generation DLL to validate the changes. If the modified address contains invalid characters or other errors, Microsoft Exchange Server displays an error message and the DLL writes an error message to the Windows NT Application event log. The RcValidateProxy routine in PROXYGEN verifies that a manually entered proxy is valid. One example of this validation is when an Exchange Server Organization name or Site name, (or both) contain spaces. For example, Organization="My Test Org" and Site="My Site." In this case, the PROXYGEN DLL would create custom recipients with the format user1@My Site.My Test Org.com. This is obviously an illegal internet SMTP name so the RcValidateProxy call would find this and an exception would be thrown along with an failed event being logged to the system.

Note  The only work-around for spaces in the organization or site names is to manually change the values for each custom recipient, or modify the PROXYGEN code.

The PROXYGEN DLL demonstrates several features for creating and modifying proxy addresses. You can use these features or similar ones in your gateway. For complete information, see the PROXYGEN sample code. The following is a summary of PROXYGEN features:

%s Substitute the user's surname.
%g Substitute the user's given name.
%d Substitute the user's display name.
%m Substitute the user's mailbox (alias) name.
%% Substitute a single %.
%r Substitute characters within a format string. See the following paragraph for details.

In all the substitutions listed in the table, spaces and illegal characters will be removed from the field before the substitution is made. If there is no format field, the site proxy address format is equivalent to:

EDK: %m@domain

Use the %r symbol to specify replacing one character with another in subsequent substitutions in the format string. For example, the format

%g%r ch1 ch2 %s

means that all instances of the character ch1 will be replaced by ch2 in all surnames as the proxy addresses are generated. In this case, since the %r symbol follows %g, given names are inserted in the proxy address with no character replacements.

You can use the path that is set up for PROXYGEN to test your own proxy generation DLL. The Address Types property page in the Microsoft Exchange Server Administrator program shows the display name and path of the proxy generation DLL. For testing, you can edit the proxy address path to point to your own proxy generation DLL. This way you can check if the DLL is generating the correct proxy address without having to install a new address type.

If you use this method, however, your DLL must produce addresses that begin with "EDK."