This morning I noticed that some of the messages in my email archive folder were threaded incorrectly in Thunderbird. This happens occasionally in Thunderbird; the upcoming major release of Thunderbird supposedly fixes the problem, but in the meantime, the workaround is to tell Thunderbird to “repair” the folder, i.e., wipe out the local copy of it and download it all again from the server.
However, the folder in question had 10k messages in it going back a year and a half, and I really didn’t want to have to download all those again, so it was time to do one of my periodic maintenance tasks and pull all the emails older than six months down from the server, archive them to my local email archive which is full-text-indexed, and then remove them from the server.
But when I tried to do that, I discovered that the script I wrote long ago for that purpose was malfunctioning due to a bug in the Mail::Box::IMAP4 Perl module which I reported in January with a description of the proper fix. It still hadn’t been fixed, so I spent about an hour digging up the link in which I had described the fix, finding the author’s GitHub repository, forking it, implementing the fix, submitting a pull request, writing Ansible code to deploy the patch to all of my machines, and deploying the patch.
Then I was finally able to download and archive the old messages, remove them from the server, and tell Thunderbird to repair the folder. Imagine my frustration when the same messages were still incorrectly threaded after the repair!
This, at long last, prompted me to do what I perhaps would and should have done in the first place if I hadn’t known about the Thunderbird bug: look more closely at the headers of the incorrectly threaded messages. they were all from Square, and they all had this in their header:
References: <messenger@messaging.squareup.com>
That’s some serious bullshit right there, Square. Kindly learn what the purpose of the References
header is, and fix your code not to put bogus References
headers in your emails, k?
(I will be adding code to my inbound email filters to strip out this bogus header automatically. Thanks, Square, for making have to waste the time to do that.)