Mail.app’s data takes up too much space on my hard drive. I know why — I’m an email packrat. I have mail dating back to 1997 on my other computer, and a lot of that mail includes attachments, because I’m constantly sending them: drafts for articles, layout drafts, art sketches, random pictures of last night’s snowfall … all sorts of attachments. And Mail.app saves those for you right within its own data files, so you don’t lose the attachment if, in the future, you delete the original file.

That means if you send a 1MB PDF to a co-worker, that 1MB PDF is now taking up 2MB+ on your hard drive; once in the original place, and once somewhere in the bowels of ~/Library/Mail/.

Side Tip: As soon as you hit the Choose File button, Mail saves the file you’re attacahing. So if you’re working on a graphic, attach it to your email, and then notice you made a typo, you must delete it from your email before you edit and re-save the document. Even if you edit and re-save overtop of the original file you attached, the first one will be sent!

Aside from taking up hard drive space, this is a potential security/privacy issue, as you may think you’ve deleted confidential files from your hard drive, but still have a copy saved with Mail’s data.

Thankfully, it’s relatively simple to get rid of all of those attachments, or at least re-save them all into a form where they’re more usable. That’s a potential reason to want to save attachments with your mail data — if you accidentally lose the original file somewhere down the road, you have them saved in your mail data and you can retrieve them. But really, that’s a last ditch resort that should be unnecessary given a backup plan, and we all have one of those, right?

Alright, let’s go through the steps to archive and delete these files.

1. Create a temporary directory on your hard drive, and inside that directory create directories for each mail account you have. You can get away with just one directory even if you have multiple accounts, but since my accounts often send files related to a single company, I can save sorting time by making these directories in advance and saving the files there.

2. Open your Sent folder, and select the first folder inside it. Turn off Threading so you can see every single email in it, and Select All, then File -> Save Attachments. Select the relevant directory to save your attachments in, and they’ll be saved in there. This step may take a little while and jack up CPU load.

3. With all your messages still selected, select Message -> Remove Attachments.

4. Select Mailbox -> Rebuild.

5. Repeat steps 2-4 with the next mailbox until you have none left.

6. If you just want to get that junk off your hard drive, burn all those attachments to CD and date it, then toss it in the pile of backup CDs full of random junk that aren’t useful and you’ll never use again. Or you can sort out the attachments, delete the ones you’ll no longer need, and safely archive the stuff that might be useful in the future.

You can, of course, do this on any other folder that you have mail in, including a Smart Mailbox — so yes, you can make a Smart Mailbox that only includes emails that have attachments, both incoming and outgoing, and simply save and delete the attachments from there. I tried this for all my incoming attachments, and it took roughly forever, but then again, I did have over three years of attachments built up, and I do find recent attachments to be useful when they’re in-line with the message, so you may want to set it up a smart folder that shows all messages with attachments that are older than, say, 90 days, and then archive and delete those, keeping attachments newer than 90 days in with your messages.

BTW, Mail helpfully adds a notice like “[The attachment file.pdf has been manually removed]” to each message you remove an attachment from, so if you need it to hunt it down at a later date, you at least know what you’re looking for.

Technorati Tags: , , ,