Friday, August 19, 2022

Thunderbird - Set Email Sorting Preference - Descending by Order Received



During extensive testing of Thunderbird for a client project I noticed that the default sort order is Ascending with new emails at the bottom. I have no clue who decided that nonsense. I need it to be "Descending" with the newest emails at the top like Gmail and I want to sort the list by "Order Received".

You can sort by category as well, such as "Order Received". I'll reference the somewhat working URLs below, the original chart, and list the options below.

The link below is dead and the WayBack Machine has nothing:

Sort Type is defined by hex values here:

If you convert hex to decimal from the "nsMsgViewSortType" in the WayBack Machine's article, you'll get the values in my chart below.

Seems the developers thought it best to not let the WayBack Machine index anything. Great job people. Also I've searched up and down and can't find these values even though they still use them. I mean it'd be great if there was an option in the UI to make these changes and apply them to all folders but, well you guessed it, there isn't.

We're talking about the latest version of Thunderbird here, v102.1.2 and the WayBack Machine's document is from 2009 ๐Ÿคฆ‍♂️.


This won't work on more than one folder unless you make this change prior to setting up your accounts. This part is very important. I know I reference where the preferences are stored below, but to avoid a huge headache after the fact, just reference this article first.


1. Thunderbird ➡ Tools ➡ Preferences ➡ Scroll all the way to the bottom ➡ Config Editor

2. Search for:

3. You'll see the following (the values below are defaults):

4. We'll edit the preferences in yellow first. There's only two options for this field, 1 or 2.

1 = Ascending
2 = Descending

Ascending (1) means, old emails at the top and new emails at the bottom.

Ascending:     OLD

Descending (2) means, new emails at the top and old emails at the bottom.

Descending:    NEW

5. Next are the preferences in blue. The following numbers correspond to the sort options:

17 = None
18 = Date
19 = Subject
20 = Author
21 = ID (Order Received)
22 = Thread
23 = Priority
24 = Status
25 = Size
26 = Flagged
27 = Unread
28 = Recipient
29 = Location
30 = Label
31 = Junk Status
32 = Attachments
33 = Account
34 = Custom
35 = Received
6. To sort everything by order received and newest at the top, copy the settings below:

*The green highlighted undo arrows show that you've modified a particular value from its default.

7. Now setup your email accounts.

8. Restart Thunderbird for good measure. Verify the changes.


The preferences you're setting are saved to a file called "prefs.js" inside of your profile folder. You can search and add the following lines at the end of the file with the settings from the charts above for mass deployments. Once you open "Thunderbird.exe" these preferences will be slotted up midway in the "prefs.js" file around line 125. So if you're looking for these settings again in the file, start at or around line 125.

user_pref("mailnews.default_news_sort_order", 2);
user_pref("mailnews.default_sort_order", 2);
user_pref("mailnews.default_sort_type", 21);


It'd be really great if the default sort order was like this out of the box. But then again developers never really listen to normal users.


No comments: