Mailing list import: posts out of order

I just imported all the emails from an old sympa mailing list (using the MBOX import guide), but some of the posts seem to be displayed out of order. However, the date stamps are correct, so I’m not sure why this is happening. I need to fix this over all imported threads, of which there are fairly many.

You can look at this post for an example of what I’m talking about, the date stamps go Jul 7, Jul 7, Jul 9, Jul 16, Aug 1, and back to Jul 7).

Is there any command I can run to re-sort the posts by date or other suggestions?

1 Like

There’s a rake task for sorting posts within a topic, but I do not recommend using it on more than a couple of topics as long as you still have a chance to fix the order within the import script.

rake posts:reorder_posts[topic_id]

Out of curiosity: Did you follow Importing mailing lists (mbox, Listserv, Google Groups, emails, ...)?
Would you mind sending me a PM with the source of all the emails in that topic? I’d like to take a look why the import script isn’t sorting the emails correctly.


Thanks for the mbox file. It looks like the sorting never really worked. It must have been luck :shamrock: that all the mbox files I imported in the past had the correct order. :man_shrugging:

Anyway, I fixed it in

Please bear in mind that it’s still possible for some messages to be appear to be in the wrong order. That’s because the post date reflects the value of the email’s Date header. It’s possible that the email client used the wrong date when sending an email. The import script determines the primary sort order by looking at the In-Reply-To and References header in order to prevent replies from showing up before any email it referenced.


This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.