Solved

Event Sink not Firing -- What Now??

Posted on 2004-08-18
7
1,241 Views
Last Modified: 2008-01-09
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
Comment
Question by:rathodr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 

Author Comment

by:rathodr
ID: 11840166
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
 
LVL 24

Expert Comment

by:David Wilhoit
ID: 11848833
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
 

Author Comment

by:rathodr
ID: 11848937
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
Office 365 Training for Admins

Learn how to provision tenants, synchronize on-premise Active Directory, and implement Single Sign-On with these master level course.  Only from Platform Scholar

 
LVL 24

Accepted Solution

by:
David Wilhoit earned 500 total points
ID: 11849022
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
 

Author Comment

by:rathodr
ID: 11866236
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
 

Author Comment

by:rathodr
ID: 11910596
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
 
LVL 24

Expert Comment

by:David Wilhoit
ID: 11913381
Congrats!
0

Featured Post

Office 365 Training for Admins

Learn how to provision tenants, synchronize on-premise Active Directory, and implement Single Sign-On with these master level course.  Only from Platform Scholar

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
how to add IIS SMTP to handle application/Scanner relays into office 365.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question