use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Outlook'; $|++; $Win32::OLE::Warn = 2; # Throw Errors, I'll catch them my $OL = Win32::OLE->GetActiveObject('Outlook.Application') || Win32::OLE->new('Outlook.Application', 'Quit'); my $NameSpace = $OL->GetNameSpace("MAPI"); my $Folder = $NameSpace->GetDefaultFolder(olFolderInbox); # map {print "Attachment Name: ". $_->Attachment(1)->{Name} ."\n";}(in ($Folder->{Items})); foreach my $msg (in $Folder->{Items}){ foreach my $atch (in $msg->{Attachments}){ my $filename = "C:\\atchs\\" . $atch->{FileName}; #print $atch->{FileName} ." in message ". $msg->{Subject} ."\n"; print $filename ."\n";#." in message ". $msg->{Subject} ."\n"; $atch->SaveAsFile($filename); } }