Hi,
I am facing some problem in accessing email header in JAVA mail API.
I face this problem specially when mail is sent from Outlook Exchange.
Please check out the scenario...
I sent an email from Outlook exchange to a email client lets assume gmail or zoho mail.
Again i go to sent items and reply to the same email and in that case In-Reply-To and ReferencesHeader are null.
So i thread emails based on one of these to properties in my application.
Same scenario works well when i send email from any other email client except outlook exchange.
Please check code snippet to get In Reply To
// InReplyTo
String[] headerArray = Message.getHeader("In-Reply-To");//No I18N
if (headerArray != null && !headerArray[0].equals("")) {
inReplyTo = headerArray[0];
}
// ReferenceHeader
String[] headerArray = Message.getHeader("References");//No I18N
if (headerArray != null && !headerArray[0].equals("")) {
referencesHeader = headerArray[0];
}
Thanks N Regards
Santosh Mishra