http://download.microsoft.com/download/exchplatinumbeta/Other/1.0/WIN98MeXP/EN-US/Smtpdisclaimer.exe
Summary
The Smtpdisclaimer.exe sample shows how to programmatically add a disclaimer to all outgoing Simple Mail Transfer Protocol (SMTP) messages.
More Information
The following file is available for download from the Microsoft Download Center:
Smtpdisclaimer.exe
Release Date: Apr-12-2002
For additional information about how to download Microsoft Support files, click the article number below to view the article in the Microsoft Knowledge Base:
Q119591 How to Obtain Microsoft Support Files from Online Services
Microsoft used the most current virus detection software available on the date of posting to scan this file for viruses. After it is posted, the file is housed on secure servers that prevent any unauthorized changes to the file.
Notable Files in Smtpdisclaimer.exe
AddDisclaimer.cpp is the C++ source file in which the OnSMTPOutCommand method is implemented.
Regsink.bat is a batch file that registers the event sink on the SMTP server. This file is located in the Sink Registration subdirectory.
Unregsink.bat is a batch file that unregisters the event sink on the SMTP server. This file is located in the Sink Registration subdirectory.
Smtpreg.vbs is a script for managing SMTP protocol and transport event sink bindings. This file is located in the Sink Registration subdirectory.
To build, register, and test Smtpdisclaimer.exe, follow these steps:
Before you build the file, complete the following steps:
In Microsoft Visual C++, click Tools, click Options, and then click Directories. Under Include file directories, make sure that you see the \Program Files\Common Files\System\ADO folder.
To create an SMTP event, you must have the Smtpevent.h, Mailmsg.h, and Seo.h header files. You can generate these files by using Microsoft Interface Definition Language (MIDL) on the Smtpevent.idl, Mailmsg.idl, and Seo.idl files that are located in the Include folder of the Platform Software Development Kit (SDK). To do this, browse to the IDL's folder from a command prompt and type the following:
midl smtpevent.idl
midl mailmsg.idl
midl seo.idl
Build the project. This produces and registers SMTPDisclaimer.dll in your debug folder.
Register your sink with the SMTP virtual server. There are two ways to do this:
Option 1: Run the Regsink.bat file that is included in the Samplesmtpevent.exe file.
Option 2: Use the Smtpreg.vbs file that is located in the \Exchsrvr\SDK\Support\CDO\Scripts folder.
NOTE: You must have the Exchange SDK installed to have this folder.
From a command prompt, browse to the \Exchsrvr\SDK\Support\CDO\Scripts folder and type the following:
cscript smtpreg.vbs /add 1 OnSessionStart SampleDisclaimer SMTPDisclaimer.AddDisclaimer "EHLO"
If this is successful, you receive a success message that is generated by the script. To unregister this event, type the following:
cscript smtpreg.vbs /remove 1 OnSessionStart SampleDisclaimer
For more information about registering events with Smtpreg.vbs, see the "Managing Event Bindings" topic in the Microsoft Developer Network (MSDN). To find this topic, search on "smtpreg.vbs" (without the quotation marks).
To test your sink, send an e-mail message to an SMTP recipient who is external to your organization. The recipient should receive a modified message with the disclaimer added to the end of the message.