Solved

Event Sink not Firing -- What Now??

Posted on 2004-08-18
7
1,239 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

We are happy to announce a brand new addition to our line of acclaimed email signature management products – CodeTwo Email Signatures for Office 365.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this video we show how to create an email address policy 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 Mail Flow…
how to add IIS SMTP to handle application/Scanner relays into office 365.

773 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