Here's the original KB to add a disclaimer to all outgoing emails from your Exchange server. [Please note this has been removed from the online KB so use at your own risk]
SAMPLE: Adding Disclaimer to Outgoing SMTP messages [Q288098]
PSS ID Number: Q288098
Article last modified on 06-20-2001
:2000,2000 SP1,2000 SP2,6.0,6.0sp4The information in this article applies to:
- Microsoft Windows versions 2000, 2000 SP1, 2000 SP2 Advanced Server
- Microsoft Windows versions 2000, 2000 SP1, 2000 SP2 Professional
- Microsoft Windows versions 2000, 2000 SP1, 2000 SP2 Server
- Microsoft Exchange 2000 Server
- Microsoft Visual C++, 32-bit Enterprise Edition, versions 6.0, 6.0sp4
- Microsoft Visual C++, 32-bit Professional Edition, versions 6.0, 6.0sp4
- Microsoft Visual C++, 32-bit Learning Edition, versions 6.0, 6.0sp4
SUMMARY
The Smtpdisclaimer.exe sample demonstrates how to programmatically add a
disclaimer to all outgoing Simple Mail Transfer Protocol (SMTP) messages.
This process uses the following technologies:
- COM
- ATL
- ADO
- SMTP Transport Events
- CDO for Windows 2000
MORE INFORMATION
The following file is available for download from the Microsoft Download
Center:
Smtpdisclaimer.exe
(http://download.microsoft.com/download/exchplatinumbeta/Other/1.0/WIN98MeXP/EN-US/Smtpdisclaimer.exe)
Release Date: Apr-30-2001
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 ofposting to scan this file for viruses. Once posted, the file is housed on secure servers that prevent any unauthorized changes to the file.
Noteable Files in Smtpdisclaimer.exe
- TransportEventInterface.cpp: C++ source file where OnMessageSubmission method is implemented
- Regsink.bat: Batch file that registers the SampleSMTPEvent sink on the SMTP server
- Unregsink.bat: Batch file that unregisters the SampleSMTPEvent sink on the SMTP server
- Smtpreg.vbs: Script for managing SMTP protocol and transport event sink bindings
To build, register, and test Smtpdisclaimer.exe, follow these steps:
1. Before you build the file, complete the following steps:
- In Visual C++, click Tools, click Options, and then click Directories. Under Include file directories, make sure that you see the Program FilesCommon FilesSystemADO folder.
- To create an SMTP event, you need the Smtpevent.h and Mailmsg.h header files. You can generate these by using Microsoft Interface Definition
Language (MIDL) on the Smtpevent.idl and Mailmsg.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 " (without the quotation marks)
"midl mailmsg.idl" (without the quotation marks)
2. Build the project. This produces and registers Samplesmtpevent.dll in your debug folder.
3. 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 ExchsrvrSDKSupportCDOScripts folder.
NOTE: You must have the exchange SDK installed to have this folder.
From a command prompt, browse to the ExchsrvrSDKSupportCDOScripts folder and type the following:
"cscript smtpreg.vbs /add 1 OnArrival SampleOnArrivalEvent
SampleSMTPEvent.TransportEventInterface "mail from=*"" (without the quotation marks)
If this is successful, you receive a success message that is generated by the script. If you want to unregister this event, type the following:
"cscript smtpreg.vbs /remove 1 OnArrival SampleOnArrivalEvent" (without the quotation marks)
For more information on 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 quotes).
4. 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.
NOTE: If you use a MAPI client such as Outlook to send the mail, you will notice that the recipient did not receive a modified message. The reason is that the message is not submitted via SMTP so the event never fires.
For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
Q288756 PRB: SMTP Transport Event OnArrival Does Not Fire For MAPI Messages
Additional query words: Smtpdisclaimer
10:17:12 PM
|