if ( my $outlook = Win32::OLE->GetActiveObject('Outlook.Application'))# connect to outlook application { # next line for debug only # print "\nSuccessfully connected to existing outlook & email"; if (defined ($outlook->ActiveInspector())) { my $activeEmail= $outlook->ActiveInspector()->{CurrentItem}; if ($activeEmail->{Class}==olMail) # if we're dealing with an email item { print "ok it's a mail"; } } }