What is the difference between these two from java mail perspective? I can see that 2 values are not same for a particular message. So what should I consider an IMAP message's unique id?
If I need to fetch message from an IMAP server corresponding to an unique id, should I use?
MessageIDTerm
or
IMAPFolder.getMessageByUID()
UID
is the unique identification number of a email in a IMAP folder
. Each mail in a folder is assigned a uid, it is you can say a index maintained by the mail folder. Whereas message-id
is a header
part of a email.
To understand in a simple term,
UID
is a unique number which cannot be duplicated within a folder. If I copy same email twice in a folder, each will have same headers having same message-id but will have a different UID.
Other major difference is,
So it is always better to rely on a UID to extract the email.
Refer : RFC - UID
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With