title: Reading Mails from Outlook Javamail
body: <p>Am trying to read the emails from the outlook using javamail</p>
  
  <p>herez the code snippet.</p>
  
  <pre><code>try {
        Properties props = new Properties();        
        props.setProperty("mail.store.protocol", "imap");
        props.setProperty("mail.imaps.starttls.enable", "true");    
        props.setProperty("mail.imaps.host", "outlook.office365.com");
        props.setProperty("mail.imaps.port", "143");    
        Session mailSession = Session.getInstance(props); 
        mailSession.setDebug(true);
        Store mailStore = mailSession.getStore("imaps");
        mailStore.connect("outlook.office365.com", "&lt;username&gt;", "&lt;password&gt;");                     
    } catch (Exception ex){
        ex.printStackTrace();
    }
  </code></pre>
  
  <p><strong><em>Exception</em></strong></p>
  
  <p>javax.mail.MessagingException: Unrecognized SSL message, plaintext connection?;
    nested exception is:
      javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
      at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:727)</p>
  
  <p>Any pointers are appreciated.</p>