banduwgs has asked for the wisdom of the Perl Monks concerning the following question:

Greatings Monks

I want to have a notify to my little perl program when I receive a new email to update one of my mail analysis database.

I am using Win32::OLE to connect local MS Outlook and I think NewMail Event will help me to get new mail arrived notification.

Do you have any idea how to deal with this event. Please let me have a simple code which will wait for a new mail and just print "New mail arrived" on the console if possible.

Many thanks - SB

  • Comment on Monitoring New Mail Reception @ Outlook

Replies are listed 'Best First'.
Re: Monitoring New Mail Reception @ Outlook
by Anonymous Monk on Sep 30, 2003 at 10:45 UTC

    Hi,

    After reading the MSDN page I reckon that is only going to fire the event when a NewMail arrives in your default message store (i.e. the inbox belonging to the profile you're using).

    Aren't you better to simply use InboxAssistant and set up a Notify rule for each of the profiles you use?

    HTH - Mark

      Thanks for your comments and I agree the fact NewMail notifies only arrival at default inbox.

      I am not planing to stick this method for my work, but I am looking for a better way to come up with a solution to satice my requirement.

      I am wondering what you meant by InboxAssistant here. Is it a tool comes with Outlook or a package for Perl? Let me have bit more details please... - SB

Update: Monitoring New Mail Reception @ Outlook
by banduwgs (Beadle) on Sep 30, 2003 at 12:46 UTC

    Hi Everyone,

    After all I could came across Using OLE Events with Win32::OLE which work perfectly with Internet Explorer. Here is the simple test code:

    use strict; use Win32::OLE qw(EVENTS); use Win32::OLE::Variant; $|=1; my $ie = Win32::OLE->new('InternetExplorer.Application'); $ie->{Visible} = 1; Win32::OLE->WithEvents($ie, \&Event, 'DWebBrowserEvents2'); while (1) { Win32::OLE->SpinMessageLoop; Win32::Sleep(100); } sub Event { my ($obj,$event,@args) = @_; print "\nEvent: $event\n"; for my $arg (@args) { my $value = $arg; $value = sprintf "[%s %s]", Win32::OLE->QueryObjectType($value) if UNIVERSAL::isa($value, 'Win32::OLE'); print " arg: $value\n"; } }

    Now my problem is what should I use in place of 'DWebBrowserEvents2'(INTERFACE) if I want to use "Outlook.Aplication" in the above code? - SB