use strict; use warnings; use Win32::OLE; use Win32::OLE::Const '.*Outlook'; my $outlook = Win32::OLE->GetActiveObject('Outlook.Application'); die "Outlook isn't running." unless $outlook; my $namespace = $outlook->GetNameSpace("MAPI"); # some code here to get the location of the mailbox and the inbox of that mailbox my $inbox = $namespace->Folders($i)->Folders($j); # some code here to get to the proper email message my $text = $inbox->Items->Item($wanted);