Mail threading

Good e-mail programs tend to display messages grouped into conversation threads: basically, messages are displayed immediately below the message they are a direct reply to, preferably with little arrows that make the relationships even clearer. In other words, a tree. Threads in a mail reader

Besides looking for “Re:” and similar at the start of the Subject: line, there are two other message headers that are used to convey threading information: References: and In-Reply-To:. I’ve never quite understood exactly how they worked—until today, when I came across this page by Jamie Zawinski. It explains precisely what the headers mean, and gives an algorithm for ordering the messages into a nice tree based on the information.