From 4e127d6c4c04c009ef542d25804bc927f6e57d5e Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 25 Dec 2017 14:47:27 +0300 Subject: email: add threading headers --- juick-api/src/main/java/com/juick/api/EmailManager.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'juick-api') 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 { 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")); -- cgit v1.2.3