Hello all,
Firstly, this question may be in a newsgroup FAQ list somewhere. Is there
one and if so can you please tell me where?
Now my query:
I checked out Micosoft Knowledge base article 317680
(http://support.microsoft.com/kb/317680/) which expains how to add a
disclaimer to my emails. I have followed the instructions, not changing the
original script at all which contains a disclaimer like "Sample Disclaimer
added in a VBScript". However, when I send messages through my exchange
server (for which ALL outgoing emails go through a SMTP connector) no
disclaimer is added. I've tried Outlook 2003, outlook express and OWA for
testing to no avail.
The following is what I've done:
1. created the script file (copy / paste job, like I said) and saved as
EventSinkScript.vbs
************* START of EventSinkScript.vbs *****************
<SCRIPT LANGUAGE="VBScript">
Sub ISMTPOnArrival_OnArrival(ByVal Msg, EventStatus)
TextDisclaimer = vbCrLf & "DISCLAIMER:" & vbCrLf & "Sample TEXT
Disclaimer added in a VBScript."
HTMLDisclaimer = "<p></p><p>DISCLAIMER:<br>Sample HTML Disclaimer added
in a VBScript."
If Msg.HTMLBody <> "" Then
'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
End If
If Msg.TextBody <> "" Then
Msg.TextBody = Msg.TextBody & vbCrLf & TextDisclaimer & vbCrLf
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>
**********END***************
2. I then need to register the event sink. I downloaded the Exchange SDK for
this but smtpreg.vbs is nowhere to be seen with this. I happen to be a
software engineer with no exchange or vbscript experience really and happen
to have Microsoft Visual Studio .Net with which I happen to find a
smtpreg.vbs script. Could this be the wrong one? Is there a new script for
binding event sinks to Exchange Standard 2003?
3. I use the above script to register my script (event sink). I've put it in
a little batch file called register.bat. This gives me the following output:
********START of registration *********************
D:\>register.bat
D:\>cscript smtpreg.vbs /add 1 onarrival SMTPScriptingHost
CDO.SS_SMTPOnArrivalS
ink "mail from =*"
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
assigning priority (28010 of 32767)
registered SMTPScriptingHost
D:\>cscript smtpreg.vbs /setprop 1 onarrival SMTPScriptingHost Sink
ScriptName "
d:\EventSinkScript.vbs"
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
set property ScriptName to d:\EventSinkScript.vbs
D:\>cscript smtpreg.vbs /enable 1 onarrival SMTPScriptingHost
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
enabled SMTPScriptingHost {4EC0B706-7E45-4D47-8A5C-FAB9642E447C}
D:\>
*********END***************
4. tested sending an email using Outlook 2003, outlook express and OWA. All
to an external email address where the messages are received without
disclaimer.
Anyone any ideas why this isn't working?
Thanks a lot,
Rogier.
Andrew Sword [MVP] - 12 Dec 2005 10:09 GMT
Here's another on how to do it in VB
http://support.microsoft.com/default.aspx?scid=kb;EN-US;317327
> Hello all,
>
[quoted text clipped - 94 lines]
> Thanks a lot,
> Rogier.