Create Event Sink to redirect email exchange 2003

BrendanKing used Ask the Experts™
Hi Guys

Please note I have never done an event sink before.

Trying to create an event sink that will copy incoming emial from one domain and send it to a second email address

I have copied smtpreg.vbs to the server.
and run scripts
cscript smtpreg.vbs /add 1 onarrival SMTPScriptingHost CDO.SS_SMTPOnArrivalSink "MAIL FROM=*"


cscript smtpreg.vbs /setprop 1 onarrival SMTPScriptingHost Sink ScriptName "C:\EventSink\Redirect_ES.vbs"

This looks to complete successfully so I assume the issue is with my event sink script.
See attached code.
Sub ISMTPOnArrival_OnArrival(ByVal Msg, EventStatus)
Dim ForwardRcpt_str


   If Msg.from="" Then
   End If


   EventStatus = cdoRunNextSink
End Sub

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Managed to get it working.

Here is how to create an event sink that will copy email inbound from one user and send to a second user.
The below scripts will redirect all emails from and send them to the original receipt and

1.      You must get a copy of smtpreg.vbs
•      Save to c:\EventSink

2.      Create and save the Script file to c:\eventSink
•      <script language="VBScript">

Sub ISMTPOnArrival_OnArrival(ByVal Msg, EventStatus )
on error resume next
Dim RecpList
RecpList = LCase(Msg.EnvelopeFields(""))
RecpList = RecpList  & ";"
' address to send to

Msg.EnvelopeFields("") = RecpList

End Sub
3.      Run the below command
•      cscript smtpreg.vbs /add 1 onarrival MailRedirect CDO.SS_SMTPOnArrivalSink "mail"
•      MailRedirect is Name of Sink
•      CDO.SS_SMTPOnArrivalSink type of Sink
•      "mail" is rule, What emails are to have the script run against.
•      this could also be Rcpt to=*
4.      Run the below Command
•      Cscript smtpreg.vbs /setprop 1 onarrival MailRedirect Sink ScriptName C:\EventSink\Redirect_ES01.vbs
•      Note MailRedirect must equal name of Sink (Onarrival MailRedirect)
5.      Restart Exchange SMTP Service

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial