Dunno how to title this better. This is a rather strange situation for which I first considered Perl, ran into a few roadblocks, a colleague started messing with VBA, ran into even more roadblocks, and I am now reconsidering Perl.

If the incoming email has a particular subject line (I can use email filter), certain information has to be extracted from the email message (I can use Perl if I can access the message contents), a record with some of the info from the message has to be inserted into a SQL-Server table (use DBI with DBD-ODBC), the message is to be possibly reformatted (of trivial difficulty), and forwarded to one or more pre-determined addresses. All this has to be accomplished unattended and with no human intervention.

The email server is Exchange, and the most likely email client is Outlook.

Initially I "assumed" we were going to use Outlook, tried to run a Perl script from within Outlook, but was not able to... we tried doing it all in VBA using ADO, but ran into a similar problem. Seems like after being burned by too many viruses accessing Outlook innards, MS has made even legitimate access to Outlook very difficult.

I am seeking any advice from fellow monks on a possible approach to solving this problem. If the technique is successful, I think I can even justify ditching Outlook completely and use some other email client. But I am not sure if I can use Perl to directly access an email received by Exchange server.

I found a few discouraging Google hits on MAPI and Perl, and a number of hits on accessing Excel spreadsheets and whatnot. Nothing of the sort I am describing above.

Thanks in advance for any guidance.


In reply to Controlling Email on Windows with Perl by punkish

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.