PRB: Cannot Implement Multiple Transport Event Methods in the Same File with JScript (263476)



The information in this article applies to:

  • Microsoft Collaboration Data Objects for Windows 2000

This article was previously published under Q263476

SYMPTOMS

You cannot implement multiple event methods for Simple Mail Transfer Protocol (SMTP) and Microsoft Network News Transport Protocol (NNTP) transport events with a single script file using Microsoft JScript scripting language. If multiple event methods are present within the same file, then an exception occurs during run time and causes the SMTP/NNTP services to stop responding or hang.

CAUSE

This problem ocurrs due to a limitation in the JScript scripting engine.

RESOLUTION

To resolve this problem, you must use a separate file for each event with JScript.

MORE INFORMATION

The following are examples of separate files for JScript events.

Smtponarrival.js:
<SCRIPT LANGUAGE="JScript">
 function ISMTPOnArrival::OnArrival(Msg, Status) {
 // Sink the code here.
 }
</SCRIPT>
				
Nntponpost.js:
<SCRIPT LANGUAGE="JScript">
 function INNTPOnPost::OnPost(Msg, Status) {
 // Sink the code here.
 }
</SCRIPT>
				
Nntponpostearly.js:
<SCRIPT LANGUAGE="JScript">
 function INNTPOnPostEarly::OnPostEarly(Msg, Status) {
 // Sink the code here.
 }
</SCRIPT>
				
Nntponpostfinal.js:
<SCRIPT LANGUAGE="JScript">
 function INNTPOnPostFinal::OnPostFinal(Msg, Status) {
 // Sink the code here.
 }
</SCRIPT>
				
The Microsoft Developer Network (MSDN) January 2000 release documentation for the topic, "Implementing Sinks with Scripting Languages," states the following:

"One script file can contain code for multiple (or all) events."

This is an incorrect statement and is corrected in the MSDN April 2000 release.

NOTE: When you use VBScript, you can place all the event method implementations within a single file.

REFERENCES

For more information about Transport Events, please see the following topic in the MSDN April 2000 release:

  • SMTP and NNTP Transport Event Sinks with CDO

Modification Type:MinorLast Reviewed:3/4/2004
Keywords:kbdocerr kbMsg kbprb kbScript KB263476