Forums Register Login
Hi To ALL ..
This is SUHANI again..
Frnds Every Message has a unique field MESSAGE ID
Any body please tell me how could i get this MESSAGE ID from Java

Thanks In Advance
Welcome Suhani,
This is not a question related to webservices. I am moving question to our java-mail forum, folks there might help you.
Message message[] = folder.getMessages();



Originally posted by Seetesh Hindlekar:
Message message[] = folder.getMessages();

Sorry, but this is the wrong answer. This does not give you the message's unique ID, it just gives you the number of the message in the folder. If you look later and messages have been deleted / added to the folder, the numbers will have changed.

You can get the Message-ID header using getHeader:

String id = message.getHeader("Message-ID");

Note that this is not 100% reliable; I've tried to use it in a real world situation, and not all mail servers add a Message-ID header to the message, even though the SMTP specification says it is required.

So don't count on it that all mail messages have a unique ID.
Squanch that. And squanch this tiny ad:
Rocket Oven Kickstarter - from the trailboss

This thread has been viewed 1086 times.

All times above are in ranch (not your local) time.
The current ranch time is
Jul 15, 2018 15:25:33.