Sick of getting annoying emails and forwards? I am!
Where I work we get hundreds of emails like this; All coming from the same sender with the same subject line. I wrote this script to take care of this problem.
use strict; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Outlook'; my $MailBox = 'Mailbox - WebOps'; my $count = 0; $|++; $Win32::OLE::Warn = 3; my $Outlook = Win32::OLE->GetActiveObject('Outlook.Application') or Wi +n32::OLE->new('Outlook.Application', 'Quit'); my $ol = Win32::OLE::Const->Load($Outlook); my $Inbox = $Outlook->GetNameSpace("MAPI")->Folders("$MailBox")->Folde +rs("Inbox") or die "Can't open MAPI namespace: $!"; my $personal = $Inbox->Folders("silent11's To-Do")->Folders("junk") or + die "Can't open MAPI namespace: $!"; foreach my $item (in $Inbox->{Items}){ # {Subject},{SenderName},{Bod +y}, etc...; if ($item->{Subject} eq 'SERVER ERROR: /cgi-bin/who_cares.pl - aut +oforwarded'){ $item->Move($personal) && $count++; } } print "\n$count items moved\n";

-silent11

In reply to perl outlook filter by silent11

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.