I am using MAPI 1.4 version.  I have problem when I retrieve an  attached 
file from a newly read mail.  If suppose the name of the attached file is 
nscript12.exe, the file gets extracted into the directory I point out to, 
but, the filename is not the same as the one I used to attach it. The 
extract filename seem to be nscript1.exe instead of nscript12.exe.  This 
definitely creates a lot of problem for my automated tool. Any help will be 
greatly appreciated.

The following code is used to extract the attachments from the read email.

use Win32::OLE qw(in with);
Win32::OLE->Initialize(Win32::OLE::COINIT_OLEINITIALIZE);
$session = Win32::OLE->new('MAPI.Session', 'Quit');

my $err = $session->Logon('Test');                                      
if ($err) { die "Logon failed:$!";}

$Message = $session->Inbox->Messages;                                   
$onemsg = $Message->GetFirst;                                                          
 # Get the last message received.
$mail_found = "false";
$file_attached = "false";
$text = "";
while (($onemsg ne "") && ($mail_found eq "false"))
{
  if ($onemsg->Unread)                                                                 
             {  
     $text = $onemsg->{Text};                                           
     $att_files = $onemsg->{Attachments};               
     if ($att_files ne "")                     
     {
        $file_count = $att_files->{Count};                                             
                 if 
($file_count >0)
        {
          for (my $i = 1; $i <= $file_count; $i++)
          {  
            $fname = $att_files->Item($i);
            $file = $fname->{Name};
            $fname->WriteToFile("c:\\temp\\$file");   
            $file_attached = "true";            
          }
        }
      }       
     $mail_found = "true";                                                             
                    }
   else                                         
   {
      $onemsg = $Message->GetNext;                              
   }
}       

**************************
$file = $fname->{Name};  The filename obtained using this line is the one 
which is displaying the incorrect filename.  This does not happen for all 
attached files.  Has anyone come across this problem.  Please help me.

Elizabeth
 

---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to