Repairing corrupt Mail attachments
A while back, I was having a strange issue with PDF attachments in Mail, but only on my MacBook Pro. I’d open an e-mail with an attached PDF, and Mail would show the file’s name, but instead of seeing a preview of the document, I’d see a small (10x10 pixel) black square. If I tried to save the PDF to the Finder, and then open it in Preview or Reader, I’d get a message stating that the PDF was corrupt. On any other Mac in the house, though, that very same PDF attachment both previewed and opened just fine. (I use IMAP, so the e-mail is the same physical message on all the machines, as it resides on the server. This hint probably won’t help for POP accounts, in which the message is removed from the server when downloaded.)
You may see problems with other forms of attachments—a Word document that appears as a long garbled string of text, for instance. I mainly receive PDF attachments, though, and that’s where I’ve noticed the problem on my Mac.
I Googled around quite a bit, looking for answers, but consistently came up empty-handed—the best answer I could find anywhere boiled down to “ask the sender to resend their e-mail, as it seems the attachment was somehow damaged in transit.” But I knew the attachment wasn’t damaged, because it worked fine on the other Macs in the house. So that narrowed the problem down to the MacBook Pro. I tried trashing Mail’s preferences, but that didn’t help. Finally, in a chat with Macworld author Kirk McElhearn, he suggested something so incredibly simple that I hadn’t though to try it: rebuild the mailbox.
So with my troublesome account selected in the Mailboxes section of Mail, I chose Mailbox -> Rebuild. After a minute or two of churning, Mail was done, and I opened a message with a previously-broken PDF attachment. To my pleasant surprise, it—and every other broken PDF in that account—worked perfectly.
I’ve only expereinced this problem on my laptop, and an acquaintance who has seen the same problem theorizes that there are two main causes—a large number of e-mails with attachments arrive at the same time, or the connection between Mail and the mail server is very slow. In either case, it seems as though Mail thinks the download is complete when it’s really not. The end result is a partially-downloaded attachment. Rebuilding the mailbox—for IMAP mailboxes, at least—forces Mail to redownload the entire message from the server, thereby fixing the attachment issue.