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

I am able to read a mail from the inbox. My actual requirement is to fetch a mail from a subfolder in Outlook by comparing the subject of the mail in the Sub-Folder with a predefined text.

use Mail::Outlook; use Win32::OLE::Const 'Microsoft Outlook'; my $outlook = new Mail::Outlook(); my $folder = $outlook->folder('Inbox'); my $message = $folder->last(); my $text = $message->Subject(); my $text1 = $message->From(); print "From : $text1\n"; print "Subject : $text\n";

Using the code above I can read the subject and from address of the mail in the inbox. But I'd like to read a mail from the sub-folder. Please provide some tips.

Replies are listed 'Best First'.
Re: read a mail from outlook from a sub folder
by Anonymous Monk on May 22, 2013 at 06:41 UTC

    But I'd like to read a mail from the sub-folder. Please provide some tips.

    What subfolder? Why don't you try folder method?

      by Sub-Folder i mean a folder that is created within the Inbox...folder method can read the mail in the parent folder, but not a sub or a child folder.

        I don't have Outlook here, but what does the all_folders method return? Is the folder you are looking for present in the return value?

        --MidLifeXis