Lion’s Mail: Export/import round-trip to remove attachments in sent messages

Posted by Pierre Igot in: Mail
December 5th, 2011 • 10:33 am

I am not sure why, but I am going through a phase where any encounter with a software bug on my computer leaves me with a feeling of intense frustration. I just cannot believe that I have to live with so many bugs that affect my work on a daily basis in my computing life, and I find it very difficult to tolerate the length of time it takes big software companies like Apple, Adobe or Microsoft to fix these bugs — if they ever fix them at all.

A while ago, I wrote about a new bug that I am experiencing in Lion’s Mail, where any sent message containing attachments is displayed in the message list without the expected paperclip attachment icon, and, more important, where the “Remove Attachments” command is disabled when the sent message is selected, which means that it is impossible to remove the attachment from the message.

This is a problem that really bothers me, because it means that large sent messages are accumulating in my Sent mailboxes and I cannot file them away, and the size of my entire Mail folder is ballooning. In less than three months, I have accumulated nearly 400 sent messages with a total file size of over 600 MB. It is simply ridiculous.

Apple still hasn’t done anything about this bug. I am not the only one experiencing it. I have received e-mail from other people complaining about the same problem, and there is a discussion thread on the Apple Support Communities web site.

Yesterday, I just got tired of waiting and decided to try and do something about it. Here is what I did.

First, I sorted my sent messages by attachment, which amazingly still appears to work. Since Mail does not display the paperclip icon, it’s a bit hard to tell where the list of messages with attachments actually starts, but one can use the message size as a guide.

Then I selected all the messages with attachments and moved them to a separate mailbox.

I selected that mailbox and chose the “Export Mailbox…” command in the contextual menu. This enabled me to save the entire mailbox as a .mbox file on my hard drive.

I then imported the .mbox file back into Mail, using the “Import Mailboxes…” command. And sure enough, once the messages were imported, they showed up in a list with their paperclip icon fully visible, and the “Remove Attachments” command was working, so I was able to remove the attachments from my sent messages.

I then deleted the original sent messages with their unremovable attachments from my Sent mailbox, and moved the stripped sent messages from the Import mailbox back into the Sent mailbox. Et voilà! My sent messages are now attachment-free, and instead of the attachments they include the proper line between square brackets indicating the names of the files that were originally attached.

Phew. Obviously the export/import round-trip using the .mbox file format does something to the message files that restores normal behaviour. It confirms my long-standing suspicion, which is that something is broken in the way Lion’s Mail encodes the sent messages. (When you upgrade to Lion from Snow Leopard, if you have sent messages with attachments in your Sent mailbox that were composed using Snow Leopard’s Mail, they behave properly, even in Lion’s
Mail. It’s only sent messages created by Lion’s Mail that pose a problem.)

I am not sure whether the round-trip actually removes useful information from the messages, but there is nothing that I can see missing. They still have the correct information in the headers (sender, recipients, etc.) and Lion’s Mail still organizes them by conversation properly, with the messages that they were originally connected to. The only glitch I have noticed is that, when a message includes both a plain text and a rich text version, the line between brackets with the name of the removed attachment only appears in the rich text alternative and not in the plain text alternative.

Obviously if you have rules that apply various colours to your messages, like I do, you’ll have to reapply the rules to the sent messages to restore their colours (via the “Message” menu). But after that, everything will be in order.

It’s obviously not a fix for the bug, but at least it enables you to periodically remove the attachments from your sent messages, which helps keep your overall Mail folder size reasonable.

Now if anyone has any tips about the steps required to provide a 100%-reproducible scenario to Apple via a bug report, I am all ears. Even though I can reproduce the problem in two different user environments on my machine, including one with zero customizations, it is apparently still not good enough…

One Response to “Lion’s Mail: Export/import round-trip to remove attachments in sent messages”

  1. Betalogue » Lion/Mountain Lion’s Mail: Workaround for removing attachments from sent messages says:

    [...] Apple seemingly unable or unwilling to fix this bug, people have come up with various workarounds. The one I have come up with works reliably for me, although it is a bit [...]