Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Mr. Muskrat (4572)

Mr. Muskrat
  reversethis-{moc ... ta} {tarksum.rm}

I'm married with 2 girls. I work as a full time Perl programmer for a Land Mobile Radio company in the Dallas/Fort Worth area.

I am enrolled at the Art Institute of Pittsburgh - Online working towards a Bachelor of Science in photography.

My other blog [blogspot.com]

Journal of Mr. Muskrat (4572)

Thursday March 20, 2008
10:03 AM

Outlook Needs Better Rules

[ #35945 ]

At $work we use Outlook with an Exchange server for our email. Recently I've taken on system administration tasks for my group. Any email sent to root on our servers goes to me.

One of the servers is running OpenNMS (apparently it's not configured correctly). OpenNMS keeps sending email to me with subjects like 'Notice #XXXX: node some.node.domain.local down' and 'RESOLVED: Notice #XXXX: node some.node.domain.local down'. Some days I get 15 or 20 notices (plus the corresponding resolved notices). Other days I get 50 - 75 notices (plus the resolved). (More often than not, the downtime is super short and I get two notices and two resolves for the same system in one minute).

Until I can finish configuring OpenNMS (so that it's not so darn sensitive) I'd like to set up Outlook to automatically mark the notice and corresponding resolve as read. Outlook's rules don't allow for wildcards or capturing or anything that resembles a 21st century feature. I've done some Excel macros in the past but I've never needed to muck with VBA in Outlook so I really don't know where to start (other than what I've found doing a Google for it). I also downloaded a few sample scripts for doing Outlook inbox/message manipulation in Perl.

Are there any Outlook gurus reading this? Do you have any suggestions?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Maybe I'm expecting too much from software that has been around as long as Outlook. Maybe I'm spoiled after using Linux for as long as I have (I've been using it since about 1998 even though I maintained a Windows system for gaming until recent). Things that I take for granted on a Linux system just don't work that way on Windows. Apparently email is one of those things.
    • Take a look at my Mail-Outlook [perl.org] distribution. Although it's not a solution for your immediate problem, it might give you a start for writing something of your own. Personally I would write a rule in Outlook to refile the incoming messages into a dedicated email folder and then have a script poll that folder every $interval minutes. You can set mail items as read/unread through the API. That's how I used to run the CPAN Testing on my Windows box :)

      • Those messages are already going to a personal folder.

        I ran across Mail::Outlook in my searches and made a note to check it out. Now that you have said that I might want to look at how you did it, I'll put it at the top of my list of things to check out.

        Thanks Barbie!

      • Any idea on how to mark items as read from Perl? I'm attempting to use the (supposedly) read/write boolean property UnRead but it's giving me "Can't modify non-lvalue subroutine call at outlook.pl line 69."

        #!/usr/bin/perl
        # This started as Shawn A. Clifford's Win32_Outlook_Folders.pl
        use strict;
        use Win32::OLE qw( in valof with );
        use Win32::OLE::Variant;
        use Win32::OLE::Const 'Microsoft Outlook';
        $| = 1;

        my $Outlook; # An instance of Outlook
        #  Use existing instance if Outlook is already running
        eval { $Ou

        • Not tried, but you might find this a bit of a d'oh! moment :)

          $Items{ $notice }{0}->{UnRead} = 0; # line 69
          $Items{ $notice }{1}->{UnRead} = 0;

          Your original call was referencing a subroutine and you can't pass arguments to subroutines like that in most languages ;) However, as this is a property you should reference it as you would a hash key/value. The internal OLE workings do the transformations, and will generate read-only accessors for some of the properties, hence the error you got. I had a sim

          • That was the problem and as soon as I saw it, I knew that it would work. Very much a d'oh moment! Thanks Barbie.