title: Download only email subject in JavaMail & imaps
body: <p>I'm trying to download only <strong>subject</strong> of emails, because it should take less time (downloading ~10 emails with photos take about 10 min :/).</p>
  
  <p>Code that I'm now using is:</p>
  
  <pre><code>    try {
          Store store = session.getStore("imaps");
          store.connect(...);
  
          Folder folder = store.getFolder(folderName);
          folder.open(Folder.READ_ONLY);
  
          message = folder.getMessages();
  
          for (Message m : message) {
              System.out.println(m.getSubject());
          }
  
          folder.close(false);
          store.close();
      } catch (MessagingException e) {
          ...
      } catch (IOException e) {
          ...
      }
  </code></pre>