How to Fix Corrupted IMAP Attachments in Apple Mail

| MGG Answers


Keith writes: I’m having a problem with mail attachments via my IMAP account accessed with Apple Mail. Sometimes, when moving an email with an attachment from my inbox or sent folder to another IMAP folder, the attachment becomes scrambled and is reproduced as base-64 text. As a result, I can’t access or view the attachment as originally intended unless I bypass Apple Mail and access my IMAP account via the web.

Is there a way to resolve this so that I can access my email attachments from Mail even after I’ve moved them to a different folder?


The problem you’re describing is unfortunately not new, with reports of this issue dating back to Mac OS 10.4 Tiger. Thankfully, the solution is simple: rebuilding the mailbox (a.k.a. folder) containing the email with the scrambled attachment will fix the problem.

To rebuild a mailbox in Apple Mail first highlight the mailbox in the sidebar on the left. Then go to Mail’s menu bar and choose Mailbox > Rebuild. This will take some time depending on the number and size of the messages in the mailbox.

Mail's Rebuild

If you have many emails in a particular mailbox but only need to perform a rebuild to fix one or two messages, you might wish to create a separate “temporary” mailbox in which you can place the damaged messages, rebuild quickly, and then gain access to the attachments. 

Mac OS X Hints has an alternative solution for those of you who have already moved a damaged message attachment off the IMAP server. 

First, open the base-64 attachment and delete the header information above the encoded data. It will look similar to this:

Content-Transfer-Encoding: base64
Content-Type: application/applefile;
Content-Disposition: attachment;

Next, making note of the file name, use Terminal and OpenSSL to decode the attachment. In Terminal type the following: 

openssl base64 -d -in mime-attachment -out file.doc 

Where “mime-attachment” is the “scrambled” attachment name and “file.doc” is the desired output name.

This question was originally answered on MGG 384: Photos, Lion Tips, Speaker Management & More!

About MGG Answers:

Each week Dave Hamilton and John F. Braun provide some great troubleshooting advice to listeners of the Mac Geek Gab podcast. Here with MGG Answers we share some of those tips with the rest of the world!

Popular TMO Stories

No Comments

Log in to comment (TMO, Twitter or Facebook) or Register for a TMO account