What is the pattern/logic behind in generating UID for Messages when using POP3 server?

StackOverflow https://stackoverflow.com/questions/8337587

سؤال

This question is out of curiosity, JavaMail API provides POP3 protocol provider to access POP3 messages. There is a method POP3Folder.getUID(message) available that return unique ID string for a message. It returns, for example, in the following format:

Example UID: 1322488254.15180.1.dummy1,S=703

My questions are:

  1. Is there any logic/pattern/algorithm behind in generating this UID uniquely for each messages?
  2. Are there any probabilities/chances of having the same UID for multiple messages? In other words, is this truly unique?
  3. Is this UID is generated by POP3 provider (JavaMail API) or returned by POP3 server?

JavaMail API doc says:

Return the unique ID string for this message, or null if not available. Uses the POP3 UIDL command.

هل كانت مفيدة؟

المحلول

It's generated by the POP3 server. Every server does it differently. How perfectly it does it depends on the server, but generally I wouldn't worry about getting the same UID for two different messages. Depending on anything about the content or structure of the UID would be a mistake. In particular, don't assume that they're sorted.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top