Hi, Using perl I wanted to read email from my outlook as soon as new email arrives then planning to implement next logic depending on the subject....

I am using Microsoft outlook 2010

I found following program from cpan but upon execution I get the following error... -------------

C:\Automation\OutlookPERL>perl reademail.pl

Can't locate Win64/OLE/Const.pm in @INC (@INC contains: ./lib C:/Perl64/site/lib C:/Perl64/lib .) at reademail.pl line 10. BEGIN failed--compilation aborted at reademail.pl line 10.

------------------- line 10 is as below------------

use Win64::OLE::Const 'Microsoft Outlook';

-----------------------------------------

I tried to get related modules from PPM but failed, I am not expert but I can say I am intermediate programmer

Please suggest how to run the following program

Thanks in advance

complete program from cpan.org -----------------------------
# create the object use Mail::Outlook; my $outlook = new Mail::Outlook(); # start with a folder my $outlook = new Mail::Outlook('Inbox'); # use the Win32::OLE::Const definitions use Mail::Outlook; use Win64::OLE::Const 'Microsoft Outlook'; my $outlook = new Mail::Outlook(olInbox); # get/set the current folder my $folder = $outlook->folder(); my $folder = $outlook->folder('Inbox'); # get the first/last/next/previous message my $message = $folder->first(); $message = $folder->next(); $message = $folder->last(); $message = $folder->previous(); # read the attributes of the current message my $text = $message->From(); $text = $message->To(); $text = $message->Cc(); $text = $message->Bcc(); $text = $message->Subject(); $text = $message->Body(); my @list = $message->Attach(); # use Outlook to display the current message $message->display; # create a message for sending my $message = $outlook->create(); $message->To('you@example.com'); $message->Cc('Them <them@example.com>'); $message->Bcc('Us <us@example.com>; anybody@example.com'); $message->Subject('Blah Blah Blah'); $message->Body('Yadda Yadda Yadda'); $message->Attach(@lots_of_files); $message->Attach(@more_files); # attachments are appended $message->Attach($one_file); # so multiple calls are allowed $message->send; # Or use a hash my %hash = ( To => 'you@example.com', Cc => 'Them <them@example.com>', Bcc => 'Us <us@example.com>, anybody@example.com', Subject => 'Blah Blah Blah', Body => 'Yadda Yadda Yadda', ); my $message = $outlook->create(%hash); $message->display(%hash); $message->send(%hash);

In reply to Regarding usage of """use Mail::Outlook;"""" on 64bit OS by ygudetti

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.