aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-12-25 14:47:27 +0300
committerGravatar Vitaly Takmazov2017-12-25 14:47:27 +0300
commit4e127d6c4c04c009ef542d25804bc927f6e57d5e (patch)
tree48ff51980755f435cb87370c49ffc53a212bd63c /juick-api/src/main
parenteda320df70c204fed7cbfb3b356b9c65b38db397 (diff)
email: add threading headers
Diffstat (limited to 'juick-api/src/main')
-rw-r--r--juick-api/src/main/java/com/juick/api/EmailManager.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/juick-api/src/main/java/com/juick/api/EmailManager.java b/juick-api/src/main/java/com/juick/api/EmailManager.java
index 2c48a745..52315ff6 100644
--- a/juick-api/src/main/java/com/juick/api/EmailManager.java
+++ b/juick-api/src/main/java/com/juick/api/EmailManager.java
@@ -58,8 +58,16 @@ public class EmailManager implements ApplicationListener<MessageEvent> {
Transport transport = session.getTransport("smtp");
MimeMessage message = new MimeMessage(session) {
protected void updateMessageID() throws MessagingException {
- if (getHeader("Message-ID") == null)
- super.updateMessageID();
+ setHeader("Message-ID", formatUrl(msg));
+ if (msg.getRid() > 0) {
+ if (msg.getReplyto() > 0) {
+ Message replyto = messagesService.getReply(msg.getMid(), msg.getReplyto());
+ setHeader("In-Reply-To", formatUrl(replyto));
+ } else {
+ Message original = messagesService.getMessage(msg.getMid());
+ setHeader("In-Reply-To", formatUrl(original));
+ }
+ }
}
};
message.setFrom(new InternetAddress("juick@juick.com"));