[Logo]
Forums Register Login
Java-Mail
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();
message[i].getMessageNumber()

Rgds,

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


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.
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards



All times above are in ranch (not your local) time.
The current ranch time is
Oct 19, 2017 05:11:57.