It sounds like you want to get all incoming (and maybe outgoing mails) to carbon copy another recipient.. (Yes, this script tags all -->incoming<-- and -->outgoing<-- messages from the SMTP server. If you want to only tag incoming mails, use the code I included for the cdoClientIPAddress to wrap around the EnvelopeFields code.
If you are using Exchange 2003, change the reference to "Microsoft CDO For Exchange 2000 Library" to "Microsoft CDO For Exchange 2003 Library".. I think.. I can't remember, and don't have the docs handy. Steven <SCRIPT LANGUAGE="PerlScript"> use Win32::OLE; Win32::OLE->Initialize(Win32::OLE::COINIT_OLEINITIALIZE); use Win32::OLE::Const ('Microsoft CDO For Exchange 2000 Library'); use Win32::OLE::Variant; #I'm not sure if the Win32::OLE::Variant is required in this particular scenario, but it shouldn't hurt. sub ISMTPOnArrival_OnArrival { my $message = $_[0]; my $straddr = '[EMAIL PROTECTED]' if ($message->EnvelopeFields->Item(cdoClientIPAddress)->{Value} eq "") { #OUTGOING } else { #INCOMING } $message->{EnvelopeFields}->Item(cdoRecipientList)->{Value} = $message->{EnvelopeFields}->Item(cdoRecipientList)->{Value}.";".$straddr ; $message->{EnvelopeFields}->Update(); $message->DataSource->Save(); $_[0] = $message; $_[1] = 0; } </SCRIPT> > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of [EMAIL PROTECTED] > Sent: Thursday, November 30, 2006 5:49 PM > To: perl-win32-users@listserv.ActiveState.com > Subject: RE: Event Sink script > > Thanks for reply. > I watched "<SCRIPT LANGUAGE="PerlScript"> in the internaet. > but cann't find samles and howto. > > > use Win32::OLE; > > Win32::OLE->Initialize(Win32::OLE::COINIT_OLEINITIALIZE); > > > > sub ISMTPOnArrival_OnArrival { > > #expecting a $message object > > my $message = $_[0]; > > my $status = 0; > > #...and so on > > } > > > > </SCRIPT> > > Do you know sites or documents showing sample code to manage > CDO, which is like this as VBScript... > > ' Add an address to this message's receivers. > Set objEnvFlds = objMsg.EnvelopeFields > objEnvFlds.Item(cdoRecipientList).Value _ > = objEnvFlds.Item(cdoRecipientList).Value & ";" & strAddr > objEnvFlds.Update > objMsg.DataSource.Save> > Regards, > HT > _______________________________________________ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > > _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs