in reply to Re: How to read only unread mail from Outlook Inbox
in thread How to read only unread mail from Outlook Inbox
Hi Satish, what is the bug/error in the below code, actually this is the same code that you have sent, i've done slight modification. This is working fine, and also i'm getting the To() value (mailid) but i'm not getting the mail id From(). use strict; use warnings; use Win32::OLE; use Win32::OLE::Const 'Microsoft Outlook'; 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; 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 = $message->From(); my $to_user = $message->To(); print "Unread Email from $from_user and to $to_user\n"; } } I'm getting error message as shown below, why we are not getting the value for From() ? Use of uninitialized value $from_user in concatenation (.) or string at Perl_Rea dUnreadMail.pl line 30. Unread Email from and to xxxxxxxx
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to read only unread mail from Outlook Inbox
by GotToBTru (Prior) on Nov 26, 2014 at 15:11 UTC | |
by karthik.raju (Acolyte) on Nov 28, 2014 at 11:24 UTC | |
by soonix (Chancellor) on Dec 01, 2014 at 21:48 UTC | |
by Anonymous Monk on Dec 04, 2014 at 06:19 UTC | |
by karthik.raju (Acolyte) on Dec 01, 2014 at 09:19 UTC |