Hi ,

I am trying to connect to outlook and read the mail content of a folder created with the name "TRY" through java mail using imap protocol.
But I am always getting "Unknown encoding: 8bit" error at the line "System.out.println(message.getContent()); " in the below given code. I tried to fix the issue by the given solutions on internet but could not succeed.
Here is the code. Server name, user name and password i have given as example but using the correct one in my app.
Java Code:
package com.itcuties.java;
 
import java.util.Properties;
 
import javax.mail.Address;
import javax.mail.Folder;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Store;
 
/**
* Class reads emails
*
* @author itcuties
*
*/
public class JavaMailReader {
 
   public static void main(String[] args) {
       readEmails(true);
   }
 
   /**
    * Method reads emails from the IMAP or POP3 server.
    * @param isImap - if true then we are reading messages from the IMAP server, if no then read from the POP3 server.
    */
   private static void readEmails(boolean isImap) {
       // Create all the needed properties - empty!
       Properties connectionProperties = new Properties();
       // Create the session
       Session session = Session.getDefaultInstance(connectionProperties,null);
        
       try {
           System.out.print("Connecting to the IMAP server...");
           // Connecting to the server
           // Set the store depending on the parameter flag value
           String storeName = isImap ? "imaps" : "pop3";    
           Store store = session.getStore(storeName);
            
           // Set the server depending on the parameter flag value
           String server = isImap ? "imap.abc.com" : "pop3.abc.com";
           store.connect(server,"coding@abc.com","P@ssw0rd1");
            
           System.out.println("done!");
            
           // Get the Inbox folder
           Folder inbox = store.getFolder("Inbox");
            
           // Set the mode to the read-only mode
           inbox.open(Folder.READ_ONLY);
            
           // Get messages
           Message messages[] = inbox.getMessages();
            
           System.out.println("Reading messages...");
            
           // Display the messages
           for(Message message:messages) {
               for (Address a: message.getFrom())
                   System.out.println("From:" + a);
                    
               System.out.println("Title: " + message.getSubject());
               System.out.println();
               [B]System.out.println(message.getContent());[/B]
               System.out.println("---");
           }
            
       } catch (Exception e) {
           e.printStackTrace();
       }
        
   }
 
}
Please help me to fix this issue.

Thanks
daniel.