diff --git a/lib/email/sender.rb b/lib/email/sender.rb index 6168b086d..34233d67d 100644 --- a/lib/email/sender.rb +++ b/lib/email/sender.rb @@ -78,10 +78,16 @@ module Email if topic_id.present? email_log.topic_id = topic_id + incoming_email = IncomingEmail.find_by(post_id: post_id, topic_id: topic_id) + + incoming_message_id = nil + incoming_message_id = "<#{incoming_email.message_id}>" if incoming_email.try(:message_id).present? + topic_identifier = "" post_identifier = "" + @message.header['Message-ID'] = post_identifier - @message.header['In-Reply-To'] = topic_identifier + @message.header['In-Reply-To'] = incoming_message_id || topic_identifier @message.header['References'] = topic_identifier topic = Topic.where(id: topic_id).first