Home  |  Services  |  About Us  |  Contact  | 

 

Brad's TechTips - Exchange Server & Outlook

[<< Full list of Exchange Server & Outlook tips.]
 
 
Exchange Server 2003: Add A Disclaimer To All Outbound SMTP Messages
 
I originally wrote this tip as an article for TechTarget SearchExchange, where it still appears.

Exchange Server 2003 is not very user-friendly when dealing with global disclaimers. In fact, the steps described in Microsoft KB 317680 ("How to Add a Disclaimer to Outgoing SMTP Messages in Visual Basic Script") will only work if you are sending messages through an SMTP smart host or a front-end Exchange server. This means that you cannot use this on a Windows Small Business Server (SBS) or any back-end Exchange server with mailboxes. You must have a separate, front-end Exchange server on which to run this code.

(NOTE: One reader of the TechTarget article did suggest a method to make this work on a single, back-end server.  See the end of this tip for that suggestion.)

If your environment does not meet those conditions, you may want to reconsider the commercial software option. The cost of the software may offset the mental aggravation that the code may otherwise give you.

If your environment does meet those conditions, however, then you can proceed to create an Exchange 2003 disclaimer as described in the KB article. You don't need to be a programmer to create a disclaimer, though it is helpful to be familiar with programming concepts.

That KB article, in summary, describes two general steps that you must take to create the disclaimer:
  1. Create and tweak the script
    1. Save the code in DisclaimerEventSinkScript to your desktop, and then rename it EventSinkScript.vbs.  (Do not click the hyperlink, as you may not be able to view the code due to the formatting.  Instead, right-click it and select the Save As option.)
       
    2. Edit the file that you just created. I recommend using Notepad.
       
    3. Modify the lines near the top of the file that start with "TextDisclaimer =" and "HTMLDisclaimer=." You can put any text you want following the equal signs, as long as it is enclosed between the quotes. Since you are not a programmer, avoid using special symbols, including other quotes, which can throw off the syntax of the statement. Here are two very simple examples:
       
      TextDisclaimer = "Disclaimer: The information in this email is confidential and should not be forwarded."
       
      HTMLDisclaimer = "Disclaimer: The information in this email is confidential and should not be forwarded."
       
    4. Save and close the file.
       
      Note: In the example provided in the Microsoft KB article, the author includes additional items between the quotes, such as vbCrLf and <p>. Both represent a carriage return and line feed putting a blank line in the text. The former is VBScript and the latter is HTML syntax. If you are comfortable using either of these languages, you can make your disclaimer more aesthetic.
       
  2. Make Exchange Server "aware" of your disclaimer by registering an event sink
    1. The smtpreg.vbs file that the KB article references does not actually appear in the Exchange Software Development Kit (SDK) as indicated. However, you can find it here on MSDN. Copy the code and paste it into a text file that you've named smtpreg.vbs.  Alternatively, download it from our Web site, and then change the TXT file extension to VBS.
       
    2. Open a command prompt and navigate the prompt to the location where you put the smtpreg.vbs file. Then paste the following code into command prompt window (don't hit Enter yet, and also make sure that each command is on a single line):

      cscript smtpreg.vbs /add 1 onarrival SMTPScriptingHost
      CDO.SS_SMTPOnArrivalSink "mail from=*@your-domain-here.com"


      cscript smtpreg.vbs /setprop 1 onarrival SMTPScriptingHost
      Sink ScriptName "c:\EventSinkScript.vbs"
       
    3. Replace your-domain-here.com with your Internet domain, and also modify the path to EventSinkScript.vbs so that it reflects the path to the file that you created in Step 1.
       
    4. Hit Enter to run the script.
       
    5. Test the disclaimer by sending an email to an external recipient.

If the sink does not appear to function, you can unregister it using the following syntax:
     cscript smtpreg.vbs /remove 1 OnArrival SMTPScriptingHost
 



Suggestion by one reader to make the disclaimer code run on a single, back-end Exchange Server:

  1. If there is a bridgehead, disable it.
     
  2. Add a second IP address to the NIC on the server.
     
  3. Add a second virtual SMTP server, call it "Outbound SMTP" and configure it to listen on the secondary IP address.
     
  4. Configure the "Default Virtual SMTP Server" to deliver all mail to the "Outbound SMTP" virtual server.
     
  5. Configure the "Outbound SMTP" to accept relay only from the primary IP address that the "Default Virtual SMTP Server" is on.
     
  6. When applying the event sinks, you apply them to instance 2 instead of instance 1 (or whatever instance your Outbound SMTP server actually is).