Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: How to read only unread mail from Outlook Inbox

by Sathishkumar (Scribe)
on Dec 02, 2014 at 10:20 UTC ( [id://1108942]=note: print w/replies, xml ) Need Help??


in reply to How to read only unread mail from Outlook Inbox

Hi Karthik, Improve your knowledge in google search. Do ask help for everything. The following code work perfect.
use strict; use warnings; use Win32::OLE; use Win32::OLE::Const 'Microsoft Outlook'; # $Win32::OLE::Warn = 3; my $outlook; $outlook = Win32::OLE->new('Outlook.Application'); die unless $outlook; my $namespace = $outlook->GetNamespace("MAPI"); my $folder = $namespace->GetDefaultFolder(6); my $items = $folder->Items; my $cnt=$items->Count; print "cnt :: $cnt \n"; for my $itemIndex (1..$items->Count) { my $message = $items->item($itemIndex); next if not defined $message; if ($message->{'Unread'}) { my $text = $message->Subject(); my $from_user; # $from_user = $from_user.$message->From(); $from_user = $from_user.$message->{'SenderEmailAddress'}; my $to_user = $message->To(); print "Unread Email from $from_user and to $to_user\n"; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1108942]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-16 11:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found