Clearing Cache in Mail on Snow Leopard

Can anyone tell me how to clear the cache in the Mail application on Snow Leopard?

I noticed that it was automatically backing up my gmail messages so it ended up caching 11GB of emails even though that's more than my account.

The only solution I seem to be able to find is to delete the files in /Users/me/Library/Mail/MyGmailAccount

Is this the best solution or is there a better way?


Solution 1:

This assumes that you're using Gmail IMAP. Set Mail.app to not keep offline copies of messages. Mail -> Preferences. Accounts -> Gmail account -> Advanced Tab. Set "Keep copies of messages for offline viewing:" to "Don't keep copies of any messages."

EDIT
As per Steve Folly's comment, it's true that with that method, Spotlight would no longer be able to access those emails for searching within entire messages. If the 11 GB of your email is mostly due to a lot of attachments, another option would be to choose "All messages, but omit attachments" in that same dropdown box. That way it would cache the text portion of the mail and you would still be able to search through it.

Gmail in Mail.app

Solution 2:

Do you use IMAP or POP access to gmail? IMAP should sync local and server content (do Mailbox > Synchronize > [account] just to make sure). POP will make copies from server and accumulate mail locally (and delete from server after a while).

If you don't want email locally, just delete it from within the Mail app.

Solution 3:

The Mailbox > Rebuild option worked great on an IMAP connection that stopped showing my older local email. It's a low-impact first thing to try before you start deleting files.