Monitoring event sink # 17 – Sample for adding disclaimer for outoging SMTP messages – VBScript


   1:  <SCRIPT LANGUAGE=“VBScript”>
   2:  Sub ISMTPOnArrival_OnArrival(ByVal Msg, EventStatus)
   3:    TextDisclaimer = vbCrLf & “DISCLAIMER:” & vbCrLf & “Sample Disclaimer added in a VBScript.”
   4:     HTMLDisclaimer = “<p></p><p>DISCLAIMER:<br>Sample Disclaimer added in a VBScript.”
   5:   
   6:     If Msg.HTMLBody <> “” Then
   7:        ‘Search for the “</body>” tag and insert our disclaimer before that tag.
   8:         pos = InStr(1, Msg.HTMLBody, “</body>”, vbTextCompare)
   9:         szPartI = Left(Msg.HTMLBody, pos – 1)
  10:         szPartII = Right(Msg.HTMLBody, Len(Msg.HTMLBody) – (pos – 1))
  11:         Msg.HTMLBody = szPartI + HTMLDisclaimer + szPartII
  12:     End If
  13:   
  14:     If Msg.TextBody <> “” Then
  15:        Msg.TextBody = Msg.TextBody & vbCrLf & TextDisclaimer & vbCrLf
  16:     End If
  17:   
  18:     ‘Commit the content changes to the transport ADO Stream object.
  19:     Msg.DataSource.Save ‘ Commit the changes into the transport Stream
  20:     EventStatus = cdoRunNextSink
  21:  End Sub
  22:  </SCRIPT>

Comments (2)
  1. VBScript Sample &lt;SCRIPT LANGUAGE=&quot;VBScript&quot;&gt; Sub ISMTPOnArrival_OnArrival(ByVal Msg,

  2. Do SMTP OnArrival Event Sinks work on Exchange 2007?  I need to migrate my SpamAssassin add-in to support Exchange 2007, but thought the Sink model was gone.

Comments are closed.