Thank you for your suggestion,
I have verified this mail.InReplyTo and mail.References properties, this is working fine with Gmail but with yahoo (like yahoo to yahoo or yahoo to gmail) the references are not maintaining.
Ex:
First mail Message-ID # <1687342428.837462.1416303027597.JavaMail.yahoo@jws10954.mail.sg3.yahoo.com>
Next Reply Mail:
Message-ID # <1702028209.837955.1416303255394.JavaMail.yahoo@jws10939.mail.sg3.yahoo.com>
In-Reply-To # <314035792.840956.1416303231163.JavaMail.yahoo@jws10943.mail.sg3.yahoo.com>
References # <314035792.840956.1416303231163.JavaMail.yahoo@jws10943.mail.sg3.yahoo.com>
Would you please help on this.
Thank you
posham