Please tell me how i can uniquely identify a message in the inbox( for checking which is old & new message). Can we use msg Id to uniques identify a recieved message. If yes, then can you please help me in collecting the differences between the msg Id & Message-ID.I mean where we have use which attribute??
Definitions of the attributes are as follow:
msg-id: as in RFC 2822 The message identifier (msg-id) itself MUST be a globally unique identifier for a message.
Message-ID: as in RFC 2822 The "Message-ID:" field provides a unique message identifier that
refers to a particular version of a particular message.
"msg-id" is just the RFC 2822 syntax term for the value of the Message-ID header.
You can use the Message-ID header, but, strictly speaking, there's no guarantee that
it's unique, or that it even exists. But it almost always works.
But for the problem of figuring out which messages are old and which are new, you
either want to use just message flags or UIDs if you're using IMAP. If you're using POP3,
see the javadocs for the com.sun.mail.pop3 package.