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

I have this code
use Win32; use Win32::OLE 'in'; my $objApp = Win32::OLE->GetActiveObject("Outlook.Application"); my $objOutlook = $objApp->GetNameSpace("MAPI"); my $objMAPIFolder = $objOutlook->GetDefaultFolder(6); foreach my $aItem (in $objOutlook->GetDefaultFolder(6)->Items +) { if ($aItem->Unread) { my $sItem = Win32::OLE->CreateObject("Redemption.SafeMail +Item"); $sItem->{Item} = $aItem; $s .= $sItem->SenderName . " -- " . $sItem->Subject . "\n +"; } }
Now I get the error "Can't call method "SenderName" on unblessed reference". Can anyone tell me what's causing this eror? I really need to query outlook and get the message body once I have this working.

Replies are listed 'Best First'.
Re: Read outlook email with redemption not quite working
by Anonymous Monk on Jul 21, 2005 at 16:30 UTC
    Try $s .= $sItem->{SenderName} . " -- " . $sItem->{Subject} . "\n"; Regards Walter
      Hi thanks but I already tried that. $sItem->{SenderName} and $sItem->{Subject} come back empty. any ideas?