Accorrding to RFC-2822 sec: 3.6.4 the "Reference" header should retain its value if the parent email has it and then appending the MSG Id of the parent mail. Using java MailApi I have set the header "Reference" to some value and sending a mail through code, but when I am giving reply to that sent mail, in the reply mail it is not retaining "Reference" header value which I was setting in the parent mail. Any way I can have the retain reference header value to the replied mail as well?
msg.setHeader("References", "reference value <ADDAFTERTHIS>");
msg.setFrom(from);
msg.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
msg.setSubject(subject);
msg.setText(text);
Transport.send(msg);
The sent email headers are as follows
From : xxxxxx
To: xxxxxxx
Message-ID: <xx1xx0110.x.16xxxx6394@xxxxxx>
References: reference value <ADDAFTERTHIS>
Subject: check from mobile Mail|Test
but from this parent mail the mail I am replying through gmail mail box is having the headers as below
Wed, 30 Mar 2022 06:16:17 -0700 (PDT)
MIME-Version: 1.0
References: <xx1xx0110.x.16xxxx6394@xxxxxx>
In-Reply-To: <xx1xx0110.x.16xxxx6394@xxxxxx>
What is going on is irrespective of what I set in the parent mail's reference in reply mail's reference the Message-Id of the parent mail it is putting.
The subject of the reply mail is also kept intact. Any help on this would be appriciated.
In the reply email the reference header's value should be kept intact as the parent email reference header with appended msg id as per RFC 2822