Event sink problem

This is a discussion on Event sink problem within the Microsoft Exchange forums in Microsoft Tools category; This is the script that I registered as SMTP OnArrival event script: <SCRIPT LANGUAGE="VBSCRIPT"> Sub IEventIsCacheable_IsCacheable() 'To implement the interface, and return S_OK implicitly Eng Sub Sub ISMTPOnArrival_OnArrival(ByVal Msg, EventStatus ) Dim envFlds Dim colAttachs Dim iFound Set envFlds = Msg.EnvelopeFields If Msg.Subject = "" Or Len(Msg.Subject) < 5 Then iFound = 0 Else iFound = Instr(1, Msg.Subject, "VIRUS", 1) ' First position of the word VIRUS End If 'Check whether the message contains a VBS attachment Set colAttachs = Msg.Attachments For Each oAttach in colAttachs If Instr(1, oAttach.FileName, "vbs", 1)> 0 Then iFound = 1 Next If iFound > ...

Go Back   Application Development Forum > Microsoft Tools > Microsoft Exchange

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 06-30-2003, 07:46 PM
Damir
Guest
 
Default Event sink problem

This is the script that I registered as SMTP OnArrival
event script:

<SCRIPT LANGUAGE="VBSCRIPT">
Sub IEventIsCacheable_IsCacheable()
'To implement the interface, and return S_OK implicitly
Eng Sub

Sub ISMTPOnArrival_OnArrival(ByVal Msg, EventStatus )
Dim envFlds
Dim colAttachs
Dim iFound
Set envFlds = Msg.EnvelopeFields

If Msg.Subject = "" Or Len(Msg.Subject) < 5 Then iFound =
0
Else
iFound = Instr(1, Msg.Subject, "VIRUS", 1) ' First
position of the word VIRUS
End If

'Check whether the message contains a VBS attachment
Set colAttachs = Msg.Attachments
For Each oAttach in colAttachs
If Instr(1, oAttach.FileName, "vbs", 1)> 0 Then iFound
= 1
Next

If iFound > 0 Then
'Do not deliver, place message in the Badmail directory.
'envFlds
("http://schemas.microsoft.com/cdo/smtpenvelope/messagesta
tus") = 3
envFlds.Item
("http://schemas.microsoft.com/cdo/SMTPenvelope/messagesta
tus").Value = 3
envFlds.Update 'Commit the changes of the message
status
'Skip remain event sinks
EventStatus = 1
End If
End Sub
</SCRIPT>

And here are my problems:

1.When the message is sent to Administrator mailbox using
Outlook 2000 (under what account the script was
registered) the script works partialy OK, meaning that it
removes messages with attachments, BUT with ANY
attachments, not only with .VBS as I intended to.

2.However, the message is not saved in BadMail directory.

3.Any message (with or without attachment) sent to any
other mailbox except Administrator's is not delivered to
the recipient mailbox since the script was instaled. In
fact, I can see it is beeing delivered in inbox and
imediately deleted/removed or whatever.

4.The script is working even if I remove it with command
line "cscript smtpreg.vbs /remove 1 onarrival
SMTPMessageCheck" which regularly reports sucess and I
can see (using MetaEdit) the event sink binding is
removed from IIS metabase.

5.How can I completely remove it?
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 01:28 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.