Question

I recently asked this question and worked out that the reason a single email message is displaying out of order is not in fact because of the date, but because of the order of the messages. I would like to modify my script to make sure all messages are in the correct order, but am unsure how to do this. Is it just based on the order in which the files appear, or is there a special part of the maildir headers which specify this?

Here is an example of what I mean: Example

In general, every MUA I use, including Thunderbird, Evolution and mail2web.com can order by date, but will be default order by the "message number". I am on a shared host which I believe uses qmail. The message number tag information must be kept somewhere.

edit: I tried moving all files to a temp directory and back again, which has shown that it is the file order which is responsible for the message number. I am however unsure as to why the messages from a few days in December have been moved to a much lower number than the numbers of messages on either side of those date. The filenames are timestamps and should be sequential, so unless mv movied the files in a strange order, I do not understand why the message numbers would not be restored for these particular files.

Was it helpful?

Solution

With maildirs, there is no inherent order for the messages. The program that displays them can show them in the order it wishes, which may be random, but can also be based, for example, on the Date header.

Your example does not identify the program that shows them, and it's anybody's guess how it orders the mails. You need to figure out what it does and fix it to order the mails in the order you want.

EDIT: The Maildir specification may be useful for digging out. If your MTA actually creates unique filenames by putting reliable timestamps, you can perhaps make do with ordering by filename. Even such filenames aren't guaranteed, it may be good enough for you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top