code: protected FileInfo getFileInfo(Message mailMessage) throws MessagingException,IOException
      {
          //get content
          Object messageContent=mailMessage.getContent();
          
          String charset=null;
          if(mailMessage instanceof MimeMessage)
          {
              //get mime message
              MimeMessage mimeMessage=(MimeMessage)mailMessage;
              
              //get charset 
              charset=mimeMessage.getEncoding();
          }
          
          String name="fax.txt";
          byte[] content=null;
          if(messageContent instanceof String)
          {
              //get content
              content=IOHelper.convertStringToBinary((String)messageContent,charset);
          }
          else if(messageContent instanceof Multipart)
          {
              //get multi part
              Multipart multiPart=(Multipart)messageContent;
              
              //get parts amount
              int amount=multiPart.getCount();
              
              Part part=null;
              DataHandler dataHandler=null;
              if(amount>0)
              {
                  //handle only the first body part
                  part=multiPart.getBodyPart(0);
                  
                  //get data handler
                  dataHandler=part.getDataHandler();
                  
                  //get values
                  name=dataHandler.getName();
                  if(name==null)
                  {
                      name="fax.txt";
                  }
  
                  //get data
                  content=IOHelper.readStream(part.getInputStream());
              }
          }
          
          //create file info
          FileInfo fileInfo=new FileInfo(name,content);
  
          return fileInfo;
      }
docs: Returns the file info from the provided mail object.<br>
  This function does not handle multiple file attachments.
  
  @param   mailMessage
  The mail message with the fax data
  @return  The file info
  @throws  MessagingException
  Any exception while handling the mail message
  @throws  IOException
  Any IO exception