Apache James 服务器:如何识别收件箱 table 中的一封电子邮件是对以前发送的电子邮件的回复还是用户发送的新邮件?

Apache James server: how to recognise whether a email in the inbox table is a reply of a previous sent email or a new message sent by the user?

我正在使用 james 服务器发送和接收电子邮件。 考虑一下我向用户发送电子邮件,然后用户回复电子邮件的情况。这封邮件将被 james 服务器保存到邮件数据库的收件箱 table 中。

然而,用户发送的所有电子邮件都保存在收件箱中table。在我的情况下,我希望能够识别电子邮件是对我之前发送的电子邮件的回复,还是只是用户发送的新消息?

寻找 MimeMessage.reply 的 post 条件。根据文档:

If setAnswered is set, the ANSWERED flag is set in this message.

The "Subject" field is filled in with the original subject prefixed with "Re:"(unless it already starts with "Re:"). The "In-Reply-To" header is set in the new message if this message has a "Message-Id" header. The current implementation also sets the "References" header in the new message to include the contents of the "References" header (or, if missing, the "In-Reply-To" header) in this message, plus the contents of the "Message-Id" header of this message, as described in RFC 2822.