title: How to manipulate a POP3 message?
body: <p>The mail store used is POP3 :</p>
  <pre><code>mail.storeType=pop3s
  mail.host=pop.moov.mg
  mail.port=995
  mail.username=somemail
  mail.password=somepassword
  mail.auth=true
  mail.ssl.trust=*
  </code></pre>
  <p>I want to retrieve e-mails, then mark them, but I cannot mark them :</p>
  <pre><code>public POP3Store getEmailStore() throws Exception {
      Properties properties = new Properties();
      properties.setProperty(&quot;mail.store.protocol&quot;, storeType);
      properties.setProperty(&quot;mail.&quot; + storeType + &quot;.host&quot;, host);
      properties.setProperty(&quot;mail.&quot; + storeType + &quot;.port&quot;, String.valueOf(port));
      properties.setProperty(&quot;mail.&quot; + storeType + &quot;.auth&quot;, String.valueOf(auth));
      properties.setProperty(&quot;mail.&quot; + storeType + &quot;.socketFactory.class&quot;, &quot;javax.net.ssl.SSLSocketFactory&quot;);
      properties.setProperty(&quot;mail.&quot; + storeType + &quot;.ssl.trust&quot;, sss_trust);
      try {
           Session emailSession = Session.getDefaultInstance(properties);
           POP3Store emailStore = (POP3Store) emailSession.getStore(storeType);
           return emailStore;
      } catch (NoSuchProviderException e) {
           e.printStackTrace();
           throw e;
      }
  }
  
  private POP3Store emailstore = null;
  emailstore = getEmailStore();
  Folder emailFolder = emailstore.getFolder(&quot;INBOX&quot;);
  emailFolder.open(Folder.READ_WRITE);
  Message[] messages = emailFolder.getMessages();
  if (messages != null) {
    for (Message message : messages) {
      if (message.getHeader(&quot;eeeee&quot;) == null || !Arrays.asList(message.getHeader(&quot;eeeee&quot;)).contains(&quot;ticket created&quot;)) {
        try {
           mailService.createTicket(message);
           mailService.mark(message);
        } catch (Exception ex) {
           throw ex;
        }
      }
    }
  }
  System.out.println(&quot;FIN Receving&quot;);
  emailFolder.close(true);
  </code></pre>
  <p>code of mailService.mark :</p>
  <pre><code>public void mark(Message message) throws MessagingException {
          try {
              message.setHeader(&quot;eeeee&quot;, &quot;ticket created&quot;);
          } catch (Exception e) {
              e.printStackTrace();
              throw e;
          }
      }
  </code></pre>
  <p>At runtime I get <code>IllegalWriteException POP3 messages are read-only</code></p>
  <p>So how to manipulate the message ?</p>