Event Sink not Firing -- What Now??
Posted on 2004-08-18
I have SBS2003 with Exch2003. I installed Metabase Editor 2.2.3 (MS). I copied a VBS sink from MS, registered it (SUCCESS), tied it to the VBS script (SUCCESS) and restarted the Default SMTP server. This actually worked a few days ago so I know it works. My email scanner also worked a few days ago too (AVG Antivirus).
I deleted a dead key using the Metabase Editor and refreshed everything. Monkeyed with the script, unregistered the working copy, registered the new version .. now the VBS script and the Anti-virus do not work (both are supposed to append text messages). Anyway, between the Metabase Editor, the VBS script and registering/unregistering, I am not sure what I screwed up. I am pretty sure it was my fault. I would like to get this back and working.
The email server, otherwise, is working fine. I send an email from yahoo and get it within a minute. The emails come to me unharmed or corrupted.
VBS Script Currently Registered (and not working): filename DetachEmailAtts.vbs
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
'Search for the "</body>" tag and insert our discliamer 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
If Msg.TextBody <> "" Then
Msg.TextBody = Msg.TextBody & vbCrLf & TextDisclaimer & vbCrLf
'Commit the content changes to the transport ADO Stream object.
Msg.DataSource.Save ' Commit the changes into the transport Stream
pEventStatus = cdoRunNextSink
Registration Command File (working since I can see it in Metabase and using cscript smtpreg.vbs /enum):
cscript smtpreg.vbs /add 1 onarrival SmtpDetachFltr CDO.SS_SMTPOnArrivalSink "mail from=*"
cscript smtpreg.vbs /setprop 1 onarrival SmtpDetachFltr Sink ScriptName "C:\path_to_file\DetachEmailAtts.vbs"