Select the product you need help with
- Internet Explorer
- Windows Phone
- More products
How to add a disclaimer to outgoing SMTP messages in Visual Basic script
Article ID: 317680 - View products that this article applies to.
This article was previously published under Q317680
For a Microsoft Visual Basic version of this article, see 317327
This step-by-step article shows how to use an SMTP transport event sink to add a disclaimer to outgoing SMTP e-mail messages.
Create the event sinkTo create an event sink, paste the following code in a new file and save it as EventSinkScript.vbs.
Register the event sinkTo register your event sink, use the Smtpreg.vbs file, which is installed with the Exchange SDK. From a command prompt, browse to the ...\Exchange SDK\SDK\Support\CDO\Scripts folder and type the following (make sure that the path to EventSinkScript.vbs is correct):
cscript smtpreg.vbs /add 1 onarrival SMTPScriptingHost CDO.SS_SMTPOnArrivalSink "mail firstname.lastname@example.org"If the command succeeds, you receive a success message generated by the script.
cscript smtpreg.vbs /setprop 1 onarrival SMTPScriptingHost Sink ScriptName "C:\EventSinkScript.vbs"
To unregister this event, type the following:
cscript smtpreg.vbs /remove 1 OnArrival SMTPScriptingHostFor more information on registering events with Smtpreg.vbs, see the "Managing Event Bindings" topic on the following MSDN Web site:
http://msdn.microsoft.com/en-us/library/ms526620(EXCHG.10).aspxFor more information, click the following article number to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/324021/ )How to create a "catchall" mailbox sink for Exchange Server
Test the event sinkTo 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 Microsoft Outlook to send the e-mail and if the Exchange mailbox resides on the same server as the event sink binding, the recipient may not receive the modified message. This is because messages that are submitted by using MAPI are not in SMTP format when the e-mail triggers the SMTP transport event. Therefore, changes that are made by the event's code are not persisted.
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/273233/ )You cannot modify MAPI messages that are trapped in an SMTP transport event sink
Article ID: 317680 - Last Review: October 25, 2007 - Revision: 10.4