title: Unable to delete messages using JavaMail
body: <p>I am using JavaMail to access an Exchange mailbox (private to the company I work for).  My applicable code is as follows:</p>
  
  <pre><code>Store store = Session.getDefaultInstance(props, null).getStore("imap");
  store.connect(...stuff...);
  Folder inbox = store.getFolder("INBOX");
  inbox.open(Folder.READ_WRITE);
  int numOfMessages = inbox.getMessageCount();
  for (int i = 1; i&lt;=numOfMessages; i++){
      Message message = inbox.getMessage(i);
      message.setFlag(Flags.Flag.DELETED, true);
      System.out.println(message.getSubject());
  }
  inbox.close(true);
  store.close();
  </code></pre>
  
  <p>It is accessing and printing out all of the message names properly.  However, with each run through, it is printing the same names over and over, indicating that they weren't actually deleting.</p>
  
  <p><strong>Resolution</strong>: <em>I found that I was throwing an error before the <code>inbox.close(true)</code> (in code I deemed inapplicable).  I'm not marking it as an answer, because this isn't a real answer.</em></p>