Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Exchange Server Disclaimer Efficiency, Reduce email size & increase Server Capacity

0.00/5 (No votes)
20 Nov 2009 1  
 Introduction This articles is intended to reduce multiple disclaimer messages when we reply and forward the  mail messages. As we know that the business related  messages  mostly replied several times and   same disclaimer message automatically added by Exchange Server everytime. It increases t

 Introduction

 This articles is intended to reduce multiple disclaimer messages when we reply and forward the  mail messages. As we know that the business related  messages  mostly replied several times and   same disclaimer message automatically added by Exchange Server everytime. It increases the message size with same disclaimer everytime when replied or forwarded.  But there is a easy solution to prevent that  if there is already one attached.  

Ofcourse this idea can be applied to any mail server which adds auto company disclaimer messages.

We will  use Microsoft support Article KB 317680 to show the solution.

This will reduce mail sizes , Internet traffic and improve Exchange Server perfprmance also..

 

 Using the Code

Simply I check the predefined disclaimer text if does not exists,  add one.. 

I  use VB Scipt sample but  it can be used/applied  with any language.

I  show added lines in bold and red  with comments.

EventSinkScript.vbs.

<SCRIPT LANGUAGE="VBScript">
Sub ISMTPOnArrival_OnArrival(ByVal Msg, EventStatus)
   TextDisclaimer = vbCrLf & "DISCLAIMER:" & vbCrLf & "Sample Disclaimer added in a VBScript."
   HTMLDisclaimer = "<p></p><p>DISCLAIMER:<br>Sample Disclaimer added in a VBScript."

   If Msg.HTMLBody <> "" Then
     <span style="COLOR: darkred">if InStr(1, Msg.HTMLBody, HTMLDisclaimer, vbTextCompare)
         > 0 Then // ** Check if there is one for HTML Message ** </span>
      'Search for the "</body>" tag and insert our disclaimer before that tag.
      pos = InStr(1, Msg.HTMLBody, "</body>", vbTextCompare)
      szPartI = Left(Msg.HTMLBody, pos - 1)
      szPartII = Right(Msg.HTMLBody, Len(Msg.HTMLBody) - (pos - 1))
      Msg.HTMLBody = szPartI + HTMLDisclaimer + szPartII
   <span style="COLOR: brown">End if //** added ** </span>   End If

   If Msg.TextBody <> "" Then
    <span style="COLOR: #8b0000">if InStr(1, Msg.TextBody, TextDisclaimer, vbTextCompare)
        > 0 Then // ** Check if there is one for Text Message ** </span>      Msg.TextBody = Msg.TextBody & vbCrLf & TextDisclaimer & vbCrLf
<span style="COLOR: #a52a2a"></span><span style="COLOR: #a52a2a">End if
    //** added **</span><span style="COLOR: #a52a2a"> </span>
   End If
    
   'Commit the content changes to the transport ADO Stream object.
   Msg.DataSource.Save ' Commit the changes into the transport Stream

   EventStatus = cdoRunNextSink
End Sub
</SCRIPT>

You can refer to Microsoft' s  KB 317680 to register EventSinkScript.vbs  on Exchange Server.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here