Skip to main content

Best way to fetch X-GM-MSGID ?

  5 posts   Feedicon  
Replies: 4 - Last Post: June 30, 2011 12:29
by: Mark McLaren
showing 1 - 5 of 5
Posted: May 29, 2011 21:14 by jimir

according to Googles API for fetching "global" gmail msgid's as specified here:

it is required to fetch "X-GM-MSGID".

After looking into the code it seams that using a FetchProfile is the best match when e.g. doing a "folder.fetch(msgs, fp)", but how do I add my own FetchProfile.Item to support fetching the above msgid ?

In javamail version 1.4.4 of class IMAPMessage it seems like the FetchProfile.Item's are used and that there is no "generic" way of adding new ones, is that correct? If so, what is the best way to proceed? Extend IMAPMessage and override methods?

I hope someone can help.

Posted: May 31, 2011 19:08 by jimir

Gmail fetching X-GM-MSGID and X-GM-THRID
Since no one has replied I implemented fetching of X-GM-MSGID and X-GM-THRID by downloading javamail 1.4.4 source and made a couple of changes. I now build my own mail.jar and have these values fetched by default.
Do you think it should be part of the javamail distribution to support these 2 extra optional FetchProfile.Item's?
I do belive a lot of people use gmail mail services and would benefit from having this build in.

Gmail searching SEARCH X-GM-RAW
I have also implemented a google search via "folder.doCommand(new IMAPFolder.ProtocolCommand() {......" so I can do server-side mail (and chat) searching, much better than the javamail that only does client-side searching. But this was easy doing outside of javamail.
But I was surprised to learn that there was no online examples (not even from google) on how to do this. It was quite a hunt to find the arguments for SEARCH X-GM-RAW that needed to be sent, but eventually found them here:
Posted: May 31, 2011 20:23 by Bill Shannon
Sorry for the late response...

I learned about these Gmail capabilities recently myself, and added them to my list
of things to consider supporting in a future release of JavaMail. If you'd like to contribute
your changes to JavaMail, perhaps as a starting point for such future support, see this page:
Posted: June 14, 2011 19:55 by c0n3j0
Hello jimir, can you post your mail.jar with this changes?
Posted: June 30, 2011 12:29 by Mark McLaren

I have also been considering this recently. We are due to integrate our university portal (uPortal) with Google Apps for Education (involving 2 legged oAuth, SAML etc). I have been trying to use a JavaMail approach rather than the Gmail Atom feed as it would offer more continuity from our existing e-mail integration (IMAP with PAM_CAS).

I would hesitate to call what I have produced a contribution but you are more than welcome to use it as you see fit (disclaimer I take absolutely no responsibility). I would imagine that for this code to surface in JavaMail proper it would need to service the needs of the many. Presently I am unencumbered by such requirements!

Replies: 4 - Last Post: June 30, 2011 12:29
by: Mark McLaren
Please Confirm