• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get uid for imap messages?

 
Ryan Stille
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm working on a web application that deals a little bit with email. The company uses a php-based webmail, I need to integrate into it by providing links that jump directly to a particular message in the webmail app. So I'm using JavaMail-imap to get the 5 most recent messages, which I display in the sidebar in my application. Then I construct links that jump to those messages in the other webmail application.

This works great for my small test mail account, but when I try one of the real accounts that have a lot of messages in it, clicking on a link in my app ends up displaying the wrong message in the php webmail app. I think the problem is java is giving me sequence numbers, and I need the actual uid of the message. I installed another PHP webmail app just to test, and looking at the links it creates, I see its using the same IDs as the first webmail app, so that leads me to believe the problem is with the IDs I'm getting from java. Both the other webmail apps connect via imap.

I've tried using the IMAPFolder.getUID(Message message) method, but that just returns me the same number I already have.

Any help appriciated, thanks.
[ October 11, 2008: Message edited by: Ryan Smith ]
 
Ryan Stille
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whooo! I got this figured out. It involved using a FetchProfile, and telling it to fetch the uid's for the messages. I'm not sure if this is how its supposed to work, I thought just calling imapFolder.getUid(Message) should return the UID for the message, but it didn't. But if I use a FetchProfile, and tell it to load the uids, then when I call imapFolder.getUid(Message) it returns the uid. I was banging my head for a while, I'm glad I got this working.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!