Solved

Event Sink not Firing -- What Now??

Posted on 2004-08-18
7
1,237 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
  • 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
Too many email signature changes to deal with?

Are you constantly being asked to update your organization's email signatures? Do they take up too much of your time? Wouldn't you love to be able to manage all signatures from one central location, easily design them and deploy them quickly to users. Well, you can!

 
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

Free book by J.Peter Bruzzese, Microsoft MVP

Are you using Office 365? Trying to set up email signatures but you’re struggling with transport rules and connectors? Let renowned Microsoft MVP J.Peter Bruzzese show you how in this exclusive e-book on Office 365 email signatures. Better yet, it’s free!

Join & Write a Comment

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
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 video we show how to create a Distribution Group in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >>…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

707 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now