[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1246
  • Last Modified:

Event Sink not Firing -- What Now??

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

<SCRIPT LANGUAGE="VBScript">
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
   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

   pEventStatus = cdoRunNextSink
End Sub
</SCRIPT>

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"

Any ideas?
0
rathodr
Asked:
rathodr
  • 4
  • 3
1 Solution
 
rathodrAuthor Commented:
UPDATE

I decided to check my mail using Outlook. I have been using OWA since this started. In Outlook, the Virus scanner's msg. shows at the bottom of the email (I just sent another email this morning and it is working). So, one question is over.

The script above still does not gen the msg. it is supposed to.

0
 
David WilhoitSenior Consultant, ExchangeCommented:
the SMTP event sink won't fire with a MAPI client, when the SMTP event sink is on the mailbox server. Even though the store uses SMTP, it's not a true SMTP transport, it's a pseudo-SMTP transaction. The SMTP event sink for the disclaimer will need to be on a front-end server.

http://support.microsoft.com/default.aspx?scid=kb;en-us;273233

Read this, I think it fits your problem.

D
0
 
rathodrAuthor Commented:
You know, I read through this before. I thought it really applied to internal email or MAPI client to SMTP. In any case, can you help me setup a border server? Or does this involve redoing the entire Exchange server setup?
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 
David WilhoitSenior Consultant, ExchangeCommented:
IT should apply that way...typically, any email you send outbound is done with MAPI client (outlook). There are tons of other ways, but that's the usual client
Setting up the border server can be something as simple as a Windows SMTP server, with the event sink installed. You'd simply forward all outbound email thru the gateway server, and then the event sink works perfectly (in theory)

D
0
 
rathodrAuthor Commented:
The server is now a bridgehead server and I have seen the DISCLAIMER above on some of the emails. I gen my own emails using telnet xxx.xxx.xxx.xxx 25 and then send a dummy email. I fiddeled around with the msg. format and have a format (formatted) that has worked a few times.

This thing is really flakey. If I make a change, I can't figure out the sequences it likes and does not like. In any case, I would eventually like to detach files automatically. So, if an email comes in with a specific format, and a specific filename in the attachment, then I would like to detach the file and save it to the hard drive.

What might I try? Any help would be appreciated.
0
 
rathodrAuthor Commented:
Kidego,

I got it working! The problem was really subtle (at least to an old C programmer). I am writing this in VB Script, but when I added an if loop to the above script, I used "endif" to close it. Looked good to me, right? Well, VBScript uses "end if" (with a space between the two separate words) as the correct syntax.

When I fixed this, I get my disclaimers and the new code working consistently and accurately.

Thank you for taking time to answer my question.
0
 
David WilhoitSenior Consultant, ExchangeCommented:
Congrats!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now