I am trying to make a sink that will nuke any emails with a small zip file attached. I have got my users pretty well trained, but sooner or later one is going to do something stupid.
I have written a vbs to do the job (mostly pinched from MS) but I can't seem to get it to fire at all!? I use the standard MS script to register the event and I says everything is ok but nothing happens. I have some diagnostic code in there but it does not produce anything.
And yes, I have restarted the Default SMTP server.
The reg code is:
cscript smtpreg.vbs /add 1 onarrival NoSmallZips CDO.SS_SMTPOnArrivalSink "rcpt to=*"
cscript smtpreg.vbs /setprop 1 onarrival NoSmallZips Sink ScriptName "c:\sinkevents\nosmallzips
The script is:
'To implement the interface, and return S_OK implicitly
yVal Msg, EventStatus)
Set fso = CreateObject("Scripting.Fi
Set wFile = fso.OpenTextFile("c:\nozip
wfile.WriteLine ("Event Sink Fired at " & Now)
Set envFlds = Msg.EnvelopeFields
Set colAttachs = Msg.Attachments
Wfile.writeline ("Mail from :" & Msg.From)
Wfile.writeline ("Mail Subject :" & Msg.Subject)
If Msg.Subject="Zip Test" Then
For Each oAttach in colAttachs
Wfile.writeline ("Filename: " & oAttach.FileName)
".vbs",-1, 1) = (Len(oAttach.FileName)-3) Then
Wfile.writeline ("Size :" & iSize)
if iSize < 100000 Then
iFound = 1
If iFound > 0 Then
'Do not deliver, place message in the Badmail directory.
") = 3
envFlds.Update 'Commit the changes of the message status 'Skip remain event sinks
EventStatus = 1
I do not get anything at all in the log file.
Please tell me I have done something stupid here.