File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes JavaMail - Reopening a pop3 folder Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "JavaMail - Reopening a pop3 folder" Watch "JavaMail - Reopening a pop3 folder" New topic

JavaMail - Reopening a pop3 folder

Bill Ostaski

Joined: Aug 25, 2003
Posts: 5
I setup a webmail webapp a year or so ago using the javamail example and now decided to add support for browsers w/o cookies enabled by using response.encodeURL(). Also moving the webapp from tomcat3.2.something to tomcat4.1.24.
Now I've stumbled across a problem with my DeleteMessageServlet - it just sets the deleted flag on a message (mailuser.setDeletedFlag(msg) and brings you back to messageheaders.jsp. For some reason, when it now returns to messageheaders.jsp, I get an indexoutofbounds exception because the number of messages w/o the deleted flag set has changed.
So I tried forwarding to DeleteMessage.jsp after setting the delete flag in DeleteMessageServlet. Here's DeleteMessage.jsp:
***** DeleteMessage.jsp *****
<%@ page errorPage="errorpage.jsp" %>
<%@ page language="java" import="com.cove.webmail.MailUserBean, javax.mail.*" %>
<jsp:useBean id="mailuser" class="com.cove.webmail.MailUserBean" scope="session" />
<title>Delete Message</title>
<body bgcolor="white">
<h3><i><%= request.getParameter("Subject") %></i></h3>
<p>will be deleted when you Logout.</p>
<% mailuser.getFolder().close(true); %>
<% if (mailuser.isLoggedIn()) { %>
<%= mailuser.getUsername() %> is still logged in.
<% } %>
<% if (mailuser.getStore() != null) { %>
<%= mailuser.getUsername() %> has store.
<% } %>
<% mailuser.getStore().getFolder("INBOX").open(Folder.READ_WRITE); %>
<% if (mailuser.getFolder().isOpen()) { %>
folder is now open.
<% } %>
***** End DeleteMessage.jsp *****
As you can see, I tried to close the folder - which should expunge the message - and then try to reopen the folder. The jsp compiles OK, I see the "user is still logged in" and "user has store," but can't seem to get the "folder is now open" to work.
Also tried to do all this through methods in MailUserBean and others. It's been three days of mind-numbing madness...
Any clues?
I agree. Here's the link:
subject: JavaMail - Reopening a pop3 folder
It's not a secret anymore!