I am trying to send the email on the same thread by passing the threadID in the "In-Reply-To" and "Reference" parameter of setHeader method but the problem is that the mail is sent but not on the same thread. Below is the code snippet that I am using Any help would be highly appreciated.
String Subject = "Re:Test Java Mail API";
String ThreadID = "PSBPR02MB43444E8F5DA233F48E0CCF9ED7309@PSBPR02MB4344.apcprd02.prod.outlook.com"
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(user));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
message.setHeader("In-Reply-To", ThreadID);
message.setHeader("References", ThreadID);
message.setHeader("Subject", Subject);
message.setContent(str, "text/html;charset=UTF-8");
Transport.send(message);