2

How to Merge Threads in Mozilla Thunderbird — The Advanced Way

bee-mascot

A reader complained that he can’t find a way to merge threads in Mozilla Thunderbird. He wasn’t satisfied with the solution I provided a few days ago.

As he explained, he needs a more in depth solution:

My usual problem is more that a discussion thread, e.g. in mailing lists is interrupted because someone didn’t properly respond to the previous mail and therefore the in-response-to (?) header of the answer is missing.

As a result the thread is disconnected in Thunderbird’s threaded view as the response starts as a new thread root. Fixing THAT is what I search for since years, but was not able to find yet.

What you suggest composes a single new mail that contains the whole threads text in a proper quoted form – that’s right. But I don’t want to full quote something, I don’t even want to write an additional mail. I want to use the Thunderbird’s View/Sort/Group by Thread feature to properly group the mails of a broken thread properly. For that your post unfortunately is not a solution.

With your proposal I can join whatever I want in any arbitrary order and nesting – but I want to say “this one mail in fact was a response to that other one”, linking the thread together again; quite a different (and as far as I know missing) feature.

Peter is correct. The “merge threads” feature is missing from Mozilla Thunderbird, even though it has been requested on numerous occasions since the year 2000.

So I looked into this problem and here is what I found.

Email Headers

While Peter was trying to work with the In-Reply-To header, that’s really not the header that tells Thunderbird to treat a message as part of a thread.

Instead, you need to study the Message-ID and References headers.

The Message-ID header gets generated every time you send an email. But the References header gets generated only if you are replying to a previous message.

So, logically, if someone sends out a new email, even though it’s referring to the topic discussed in a previous thread, Thunderbird has no way of identifying this standalone message as part of a thread.

As a test, I turned on the threaded view in Mozilla Thunderbird.

Display message threads turned on

Display message threads turned on

Then, I sent a few messages back and forth between two of my email accounts.

Breaking the thread

Breaking the thread

And, finally, I broke the thread by sending a standalone message without using the Reply button but keeping the same Subject line.

Breaking the thread, part 2

Breaking the thread, part 2

Peter’s question is, in effect, how to include that one message in the thread where it clearly belongs.

What to do? What to do?

Merge Threads with Header Tools Lite

Header Tools Lite is an add-on that enables you to edit some of the email headers in Mozilla Thunderbird:

Change Header Details

Change Header Details

…or even to directly mess around in the source of the email message:

edit full source

Edit the source of the message

For the purposes of our problem, it is enough to work with the Change header details option.

To have this option enabled, you need to install the Header Tools Lite add-on. Then right-click on a message and select HeaderToolsLite > Change header details at the very bottom of the drop-down menu.

Install the Add-on

To install the add-on, press Alt on your keyboard, then click Tools > Add-ons in the revealed menu bar.

Alternatively, you can click on the hamburger menu icon (≡) in the upper right corner of Thunderbird’s right pane, then on the Add-ons menu item.

In the Add-ons Manager page, click on the Get Add-ons menu item, type Header Tools Lite in the search box, and click on the magnifying glass icon.

get add-ons

Get Add-ons

As it happens, Header Tools Lite is not on the shortlist. Not to worry, just click on the See all 387 results link.

add-on not on the shortlist

Header Tools Lite is not on the shortlist

This will open up the Thunderbird Add-ons web page inside the email client. Header Tools Lite will be the first result. Just click on the + Add to Thunderbird button next to it.

Thunderbird Add-ons search results

Thunderbird Add-ons search results

The add-on will be installed. You will need to restart Thunderbird for the changes to take effect.

The System of References

Looking at the header details of each message in my test in the order they were sent out, reveals a system of references.

The first message

The first message

The second message (or first reply)

The second message (or first reply)

The third message (or second reply)

The third message (or second reply)

The fourth message (or third reply)

The fourth message (or third reply)

The fifth message (sent as a standalone message outside of the thread)

The fifth message (sent as a standalone message outside of the thread)

Clearly, the Message-ID of the message that is being replied to is copied to the References header. And every further reply keeps the previous content of the References header and adds the Message-ID of the last message that’s being replied to the end of the References header.

So, as the conversation grows, the References header includes all the Message-ID headers in the exact order as they were sent out. That’s why Mozilla Thunderbird is able to place all the messages that are being mentioned in the References header into one logical thread.

When someone breaks this chain of references, Thunderbird (or any other email client for that matter) has no way of knowing that a new standalone message belongs to a thread. This is exactly what happened in my test, too.

The only way to re-include a standalone message into an existing thread is to correct that message’s References header. In other words, you need to look up and copy-paste all the relevant Message-ID headers into the standalone message’s References header.

In my test case I had to add the following message IDs to the References header of the standalone message:

There were four preceding messages, so there had to be four Message-IDs added.

Once I added the correct references:

references added

Correct Message-IDs added to References header

…the message was magically placed into the thread at the correct location, where it belonged.

message reincluded in thread

Standalone message added to its thread

A Bug

Unfortunately, Header Tools Lite can play tricks with the email folders in Mozilla Thunderbird. Namely, emails may appear to be missing — so an entire folder may look empty.

What you need to do, should this happen to you after installing Header Tools Lite is to:

  1. right-click on the seemingly blank folder’s name in the left pane
  2. select the Properties item in the drop-down menu
  3. click on the Repair Folder button in the General Information tab of the newly opened window
Repair Folder

Repair Folder in Mozilla Thunderbird

Once you repair the folder or folders, the add-on doesn’t cause any more troubles.

Final Thoughts

It would be nice to have the option of selecting the Message-IDs of messages from a list or highlighting all messages belonging to a thread and the add-on would just merge them all with the click of a button.

So far, I haven’t found such an add-on, but I will keep looking and report back here about my findings.

If you know about other cool add-ons that solve the merge threads problem in Mozilla Thunderbird in a better or more efficient way than Header Tools Lite, please, let us know in the comments section below.

Liked this post?

Subscribe to our newsletter to receive early notification of new posts and deals:

Next Post »« Previous Post

Comments 2

  1. Thank you for this instruction. It can be very helpful.

    I use TB with IMAP and GoogleMail.
    Where do I end up when I change the header of a local mail.
    Will this change be synchonized?

    BR
    Eddi

  2. Peter Post
    Author

    Edgar,

    You can change email headers locally in Thunderbird as you like. These changes won’t be touched by future synchronizations. So, you’ll end up with different headers on your local emails as compared with your Google Mail headers.

    However, you should backup your local email regularly. Just in case your local database file gets corrupted. Then you’d have to remove your account from Thunderbird and re-create it, which would trigger a full synchronization with Google Mail’s IMAP servers. In such a case, obviously, all your changed headers would be gone as all your emails would get re-downloaded from Google.

    I hope this makes sense. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *