Better email headers for In-Reply-To and References

Previously, the References header emitted by the system for new thread entry auto-responses and alerts included the message-id for which the email was a reply in the `References` header. This patch corrects the issue by
placing the reply message-id in the In-Reply-To header, and constructs a correct References header.

That is, if available, the References header received in the email that was used to create the thread entry is appended to the message-id the email is actually in reply to. This is the expected usage of the References header.